Skip to content

Commit

Permalink
Upgrade version 3.0.1 - 2022/03/24
Browse files Browse the repository at this point in the history
  • Loading branch information
mxnt10 committed Mar 25, 2022
1 parent a4c378f commit 8d62572
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 39 deletions.
15 changes: 14 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@ All notable changes to this project will be documented in this file.
Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.


## [ 3.0 ] - 2022-03-20 #############################################
## [ 3.0.1 ] - 2022-03-24 ###########################################

### Changed / Modificado
- Changed error control.
###

### Fixed / Corrigido
- Fixed notificaton function.
###

#####################################################################


## [ 3.0 ] - 2022-03-20 #############################################

### Added / Adicionado
- Project development using version 3.0 of the webapp whats.
###

Expand Down
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<h1 align="center">
Whats - WhatsApp Desktop
<br/><br/>
<a><img src="https://raw.githubusercontent.com/mxnt10/whats/master/common/preview.png"></a>
</h1>

Unofficial webapp for WhatsApp Web using python and PyQt5 with PyQtWebEngine.

### Required packages
<html>
<body>
<h1 align="center">
GNotifier - Gmail Notifier
</h1>
<h3 align="center">
Unofficial webapp for Gmail using python and PyQt5 with PyQtWebEngine.
</h3>
<h3 align="center">
<a><img src="https://raw.githubusercontent.com/mxnt10/gnotifier/master/common/preview.png"></a>
</h3><br/>
</body>
</html>

## Required packages

- python >= 3.6
- libnotify (notify-send) >= 0.7.9
Expand All @@ -19,7 +25,14 @@ Unofficial webapp for WhatsApp Web using python and PyQt5 with PyQtWebEngine.
- requests >= 2.25.1
- soupsieve >= 2.3.1

### Installation instructions
## Shotcuts

- Ctrl+R: Reload webapp page.
- Ctrl+Q: Quit application.
- Alt+S: Open settings.
- Backspace: Back webapp page.

## Installation instructions

To install "Whats", use the following commands:
```sh
Expand All @@ -29,7 +42,7 @@ $ cd whats
$ sudo ./install.sh
```

### GNU General Public License
## GNU General Public License

This repository has scripts that were created to be free software.<br/>
Therefore, they can be distributed and/or modified within the terms of the *GNU General Public License*.
Expand All @@ -38,12 +51,12 @@ Therefore, they can be distributed and/or modified within the terms of the *GNU
>
>Free Software Foundation (FSF) Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
### Comments
## Comments

In case of bugs, problems of execution or construction of packages, constructive criticism, among others,
please submit a message to one of the contacts below.

### Contact
## Contact

Maintainer: Mauricio Ferrari<br/>
E-Mail: *m10ferrari1200@gmail.com*<br/>
Expand Down
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
3.0.1
Binary file modified common/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from os import chmod, makedirs
from shutil import rmtree

# Módulos do PyQt5
from PyQt5.QtCore import qDebug

# Modulos integrados (src)
from version import __appname__

Expand All @@ -27,4 +30,4 @@ def prevent():
makedirs(log_folder)
chmod(log_folder, 0o444) # Impedir alteração
except Exception as msg:
print(msg)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(msg) + '...\033[m')
6 changes: 4 additions & 2 deletions src/jsonTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

# Módulos importados
from json import dump, load
from logging import warning
from os import makedirs, remove
from os.path import expanduser, isdir

# Módulos do PyQt5
from PyQt5.QtCore import qDebug

# Modulos integrados (src)
from version import __appname__

Expand Down Expand Up @@ -40,7 +42,7 @@ def checkSettings():
with open(j_file):
pass
except Exception as msg:
warning("\033[33m %s. \033[32mCreate a settings.json ...\033[m", msg)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(msg) + '. \033[32mCreate a settings.json...\033[m')
if not isdir(j_folder):
makedirs(j_folder)
with open(j_file, 'w') as jfile:
Expand Down
6 changes: 4 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from threading import Thread

# Módulos do PyQt5
from PyQt5.QtCore import QUrl, QFileInfo, pyqtSlot, QMargins, Qt, QEvent, QTimer, pyqtSignal, QTranslator
from PyQt5.QtCore import QUrl, QFileInfo, pyqtSlot, QMargins, Qt, QEvent, QTimer, pyqtSignal, QTranslator, qDebug
from PyQt5.QtGui import QIcon, QDesktopServices, QKeySequence
from PyQt5.QtMultimedia import QMediaPlayer
from PyQt5.QtWebEngineWidgets import (QWebEngineView, QWebEnginePage, QWebEngineDownloadItem, QWebEngineSettings,
Expand Down Expand Up @@ -172,6 +172,8 @@ def bs(self, htm, parser):
try:
if not __err__ in res.title and res.findAll('img', {'class': 'gb_wc'}):
verifyNotify(self, res)
else:
self.soma = 0
if __err__ in res.title: # Em caso de erro de conexão o título inicial não se altera
if self.changeTray != 1:
self.tray.setIcon(QIcon(setIcon('error')))
Expand All @@ -185,7 +187,7 @@ def bs(self, htm, parser):
self.tray.setIcon(QIcon(setIcon('original')))
self.changeTray = 3
except Exception as err:
warning('\033[33m %s.\033[m', err)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(err) + '.\033[m')


# Função que manipula o código-fonte do webapp para a checagem das mensagens não lidas, emitindo sons,
Expand Down
15 changes: 10 additions & 5 deletions src/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from os.path import realpath
from subprocess import run

# Modulos integrados (src)
from PyQt5.QtCore import QUrl
# Módulos do PyQt5
from PyQt5.QtCore import QUrl, qDebug
from PyQt5.QtMultimedia import QMediaContent

# Modulos integrados (src)
from jsonTools import set_json
from utils import setIcon, setSound
from version import __pagename__
Expand All @@ -30,7 +31,11 @@ def notifyMessage(self):
# Essa função pode variar conforme o webapp.
def verifyNotify(self, res):
self.soma = 0
num = [int(temp) for temp in str(res.findAll('span', {'class': 'nU n1'})[0]).split() if temp.isdigit()]
try:
num = [int(temp) for temp in str(res.findAll('span', {'class': 'nU n1'})[0]).split() if temp.isdigit()]
except Exception as err:
qDebug('\033[31m[DEBUG]\033[33m: ' + str(err) + '.\033[m')
num = [0]
self.soma = num[0]
if self.soma != self.notify and self.soma != 0:
self.notify = self.soma # Necessário para mapear alterações no número de notificações
Expand All @@ -43,7 +48,7 @@ def verifyNotify(self, res):
self.notify_sound.play()
if set_json('NotifyMessage') and not self.sysLogin:
notifyMessage(self)
except Exception:
pass
except Exception as err:
qDebug('\033[31m[DEBUG]\033[33m: ' + str(err) + '.\033[m')

self.sysLogin = False # Redefinição após a primeira verificação
23 changes: 11 additions & 12 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

# Módulos importados
from logging import warning, error
from os import remove, walk
from os.path import expanduser, isfile, realpath, isdir
from subprocess import run
Expand All @@ -10,7 +9,7 @@
from shutil import copy

# Módulos do Qt5
from PyQt5.QtCore import QUrl
from PyQt5.QtCore import QUrl, qDebug
from PyQt5.QtMultimedia import QMediaContent

# Modulos integrados (src)
Expand All @@ -36,13 +35,13 @@ def setIcon(entry_icon=None):
with open(icon):
return icon
except Exception as msg:
warning('\033[33m %s.\033[32m Use a local icon...\033[m', msg)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(msg) + '. \033[32mUse a local icon...\033[m')
try:
with open(l_icon):
return l_icon
except Exception as msg:
except Exception as err:
# Caso nenhum ícone seja encontrado, vai sem ícone mesmo
error('\033[31m %s \033[m', msg)
qDebug('\033[31m[DEBUG]:' + str(err) + '.\033[m')
return None


Expand All @@ -60,8 +59,8 @@ def setDesktop():
remove(desk)
return True

except Exception as msg: # Se o arquivo não existe, não tem porque ativar a opção autostart
error('\033[31m %s \033[m', msg)
except Exception as err: # Se o arquivo não existe, não tem porque ativar a opção autostart
qDebug('\033[31m[DEBUG]:' + str(err) + '.\033[m')
write_json('AutoStart', False)
return False

Expand All @@ -76,12 +75,12 @@ def setSound(sound):
with open(dirSound + ext):
return dirSound + ext # Esse aqui não precisa realpath, pois é caminho absoluto
except Exception as msg:
warning('\033[33m %s.\033[32m Use a local sound folder...\033[m', msg)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(msg) + '. \033[32mUse a local sound folder...\033[m')
try:
with open(l_dirSound + ext):
return l_dirSound + ext
except Exception as msg:
warning('\033[33m %s.\033[32m Use a other option...\033[m', msg)
qDebug('\033[31m[DEBUG]\033[33m: ' + str(msg) + '. \033[32mUse a other option...\033[m')


# Cria uma lista com as opções de temas de som.
Expand All @@ -103,7 +102,7 @@ def setTranslate():
if not isdir(dirTranslate):
dirTranslate = __dir__ + '/translate'
else:
warning('\033[32m Using a local translate folder...\033[m')
qDebug('\033[31m[DEBUG]\033[32m: Using a local translate folder...\033[m')
return dirTranslate


Expand All @@ -118,7 +117,7 @@ def checkUpdate(self, num):
if res.status_code != 200:
raise ValueError('Connection fail, ' + str(res.status_code))

new_ver = res.text.split("\n")
new_ver = res.text.split('\n')
if new_ver[0] != str(__version__):
com = 'notify-send --app-name="' + __appname__ + ' - ' + self.textUpdate1 + '" --expire-time=' +\
str(set_json('TimeMessage')) + ' "' + self.textUpdate2 + '.\n' + self.textUpdate3 +\
Expand All @@ -128,4 +127,4 @@ def checkUpdate(self, num):
self.notify_sound.play()

except ValueError as msg:
error("\033[33m Update check failed.\033[31m %s \033[m", msg)
qDebug('\033[31m[DEBUG]\033[33m: Update check failed. \033[31m' + str(msg) + '.\033[m')
4 changes: 2 additions & 2 deletions src/version.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

__appname__ = 'GNotifier'

__pagename__ = __appname__ + ' - GMail Notifier'
__pagename__ = __appname__ + ' - Gmail Notifier'

__version__ = '3.0'
__version__ = '3.0.1'

__url__ = 'https://mail.google.com/'

Expand Down

0 comments on commit 8d62572

Please sign in to comment.