Skip to content

Commit 17f30c0

Browse files
committed
GSyncftp modified for online publication
1 parent ab71817 commit 17f30c0

File tree

7 files changed

+30
-12
lines changed

7 files changed

+30
-12
lines changed

HSync.py renamed to Main.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# from asyncqt import QEventLoop
99
from PyQt5.QtCore import Qt, pyqtSlot
1010
from PyQt5.QtGui import QIcon
11-
from PyQt5.QtWidgets import QAction, QListWidgetItem
11+
from PyQt5.QtWidgets import QAction, QListWidgetItem, QStyleFactory
1212
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, qApp
1313

1414
from FileUtils import WatchFiles
@@ -25,7 +25,6 @@
2525
APP_PATH = os.path.dirname(sys.executable)
2626
elif __file__:
2727
APP_PATH = os.path.dirname(__file__)
28-
# print(APP_PATH)
2928

3029

3130
def resource_path(relative_path):
@@ -38,10 +37,18 @@ def resource_path(relative_path):
3837

3938

4039
CONFIGS = {}
41-
if os.path.isfile(APP_PATH + "\\config.json"):
42-
with open(APP_PATH + "\\config.json") as config_file:
43-
CONFIGS = json.load(config_file)
44-
40+
if not APP_PATH:
41+
if os.path.isfile("config.json"):
42+
with open("config.json") as config_file:
43+
CONFIGS = json.load(config_file)
44+
else:
45+
print("File does not exist!\n%s" % APP_PATH + "\\config.json")
46+
else:
47+
if os.path.isfile(APP_PATH + "\\config.json"):
48+
with open(APP_PATH + "\\config.json") as config_file:
49+
CONFIGS = json.load(config_file)
50+
else:
51+
print("File does not exist!\n%s" % APP_PATH + "\\config.json")
4552

4653
@pyqtSlot("QWidget*", "QWidget*")
4754
def on_focus_out(old, now):
@@ -98,10 +105,17 @@ def swap_icon():
98105
task.status_synced()
99106

100107

108+
# Enable High DPI display with PyQt5
109+
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
110+
101111
app = QApplication(sys.argv)
112+
app.setStyle("fusion")
102113
app.setQuitOnLastWindowClosed(False)
103114
qApp.focusChanged.connect(on_focus_out)
104115

116+
if hasattr(QStyleFactory, 'AA_UseHighDpiPixmaps'):
117+
app.setAttribute(Qt.AA_UseHighDpiPixmaps)
118+
105119
menu_login = QAction('Login')
106120
menu_login.triggered.connect(lambda: logout() if session.logged_status else Login(session).exec_())
107121
session = LoginSession()

controller/CLogin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ def __init__(self, login_status, retorno=None, parent=None):
1414
self.login_status = login_status
1515
self.retorno = retorno
1616

17+
# online authentication
1718
def do_login(self):
18-
url_api = "https://sistemas.lifting.com.br/lifting_ocs/Usuario/login"
19+
url_api = "https://sitename.com/endpoint/login"
1920
data = parse.urlencode({
2021
"username": self.username.text(),
2122
"password": self.passw.text()

controller/CUpload.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def map_files(self, path, count=0):
3838
@asyncio.coroutine
3939
async def __async_upload(self, file_path):
4040
try:
41-
file_dest = file_path.replace(self.path_sync, "").replace("\\", '/')
42-
async with aioftp.ClientSession("lft-srv-003", 21, "user_hass", "Insp3cti@n") as client:
41+
file_dest = file_path.replace(self.path_sync, "").replace(os.environ["HOMEDRIVE"]+os.sep, "").replace("\\", '/')
42+
async with aioftp.ClientSession("host", 21, "user", "pass") as client:
4343
if not await client.exists(file_dest.split('/')[1]):
4444
try:
4545
await client.make_directory(file_dest.split('/')[1])

make.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
"--exclude-module FixTk "
3232
"--noconsole "
3333
# "--onefile "
34-
"{}\\GSyncftp.py".format(os.getcwd()))
34+
"{}\\Main.py".format(os.getcwd()))

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
watchdog>=0.10.2
2+
aioftp>=0.15.0
3+
PyQt5>=5.14.1

ui/TaskList.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ QLineEdit{
109109
</font>
110110
</property>
111111
<property name="text">
112-
<string> LIFTING ESTALEIROS LTDA</string>
112+
<string> COORP LTDA</string>
113113
</property>
114114
<property name="textFormat">
115115
<enum>Qt::AutoText</enum>

view/SyncFolder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ def retranslate(self, Dialog):
3838
_translate = QtCore.QCoreApplication.translate
3939
Dialog.setWindowTitle(_translate("Dialog", "Manual Synchronize"))
4040
self.lineEdit.setPlaceholderText(_translate("Dialog", "Informe a pasta para backup"))
41-
self.label.setText(_translate("Dialog", "OS"))
41+
self.label.setText(_translate("Dialog", ">"))
4242
self.pushButton.setText(_translate("Dialog", "Enviar"))
4343
self.Button_Cancel.setText(_translate("Dialog", "Cancelar"))

0 commit comments

Comments
 (0)