diff --git a/include/ui/files_ui.py b/include/ui/files_ui.py
index a335e8f..09faa0f 100644
--- a/include/ui/files_ui.py
+++ b/include/ui/files_ui.py
@@ -11,7 +11,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_win_files(object):
def setupUi(self, win_files):
win_files.setObjectName("win_files")
- win_files.resize(725, 592)
+ win_files.resize(725, 519)
self.centralwidget = QtWidgets.QWidget(win_files)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
@@ -20,12 +20,12 @@ class Ui_win_files(object):
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setChildrenCollapsible(False)
self.splitter.setObjectName("splitter")
- self.gridLayoutWidget = QtWidgets.QWidget(self.splitter)
- self.gridLayoutWidget.setObjectName("gridLayoutWidget")
- self.vl_local = QtWidgets.QVBoxLayout(self.gridLayoutWidget)
+ self.verticalLayoutWidget = QtWidgets.QWidget(self.splitter)
+ self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+ self.vl_local = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.vl_local.setContentsMargins(0, 0, 0, 0)
self.vl_local.setObjectName("vl_local")
- self.gb_select_local = QtWidgets.QGroupBox(self.gridLayoutWidget)
+ self.gb_select_local = QtWidgets.QGroupBox(self.verticalLayoutWidget)
self.gb_select_local.setObjectName("gb_select_local")
self.gridLayout_2 = QtWidgets.QGridLayout(self.gb_select_local)
self.gridLayout_2.setObjectName("gridLayout_2")
@@ -57,7 +57,21 @@ class Ui_win_files(object):
self.gridLayout_2.addWidget(self.lbl_path_local, 1, 0, 1, 3)
self.gridLayout_2.setColumnStretch(0, 1)
self.vl_local.addWidget(self.gb_select_local)
- self.tree_files_local = QtWidgets.QTreeWidget(self.gridLayoutWidget)
+ self.hl_revpi_2 = QtWidgets.QHBoxLayout()
+ self.hl_revpi_2.setObjectName("hl_revpi_2")
+ spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hl_revpi_2.addItem(spacerItem)
+ self.btn_to_right = QtWidgets.QPushButton(self.verticalLayoutWidget)
+ self.btn_to_right.setText("")
+ icon2 = QtGui.QIcon()
+ icon2.addPixmap(QtGui.QPixmap(":/action/ico/arrow-right.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.btn_to_right.setIcon(icon2)
+ self.btn_to_right.setIconSize(QtCore.QSize(24, 24))
+ self.btn_to_right.setAutoDefault(False)
+ self.btn_to_right.setObjectName("btn_to_right")
+ self.hl_revpi_2.addWidget(self.btn_to_right)
+ self.vl_local.addLayout(self.hl_revpi_2)
+ self.tree_files_local = QtWidgets.QTreeWidget(self.verticalLayoutWidget)
self.tree_files_local.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.tree_files_local.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.tree_files_local.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
@@ -95,15 +109,6 @@ class Ui_win_files(object):
self.vl_revpi.addWidget(self.gb_select_revpi)
self.hl_revpi = QtWidgets.QHBoxLayout()
self.hl_revpi.setObjectName("hl_revpi")
- self.btn_to_right = QtWidgets.QPushButton(self.gridLayoutWidget_2)
- self.btn_to_right.setText("")
- icon2 = QtGui.QIcon()
- icon2.addPixmap(QtGui.QPixmap(":/action/ico/arrow-right.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
- self.btn_to_right.setIcon(icon2)
- self.btn_to_right.setIconSize(QtCore.QSize(24, 24))
- self.btn_to_right.setAutoDefault(False)
- self.btn_to_right.setObjectName("btn_to_right")
- self.hl_revpi.addWidget(self.btn_to_right)
self.btn_to_left = QtWidgets.QPushButton(self.gridLayoutWidget_2)
self.btn_to_left.setText("")
icon3 = QtGui.QIcon()
@@ -122,8 +127,8 @@ class Ui_win_files(object):
self.btn_delete_revpi.setAutoDefault(False)
self.btn_delete_revpi.setObjectName("btn_delete_revpi")
self.hl_revpi.addWidget(self.btn_delete_revpi)
- spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.hl_revpi.addItem(spacerItem)
+ spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hl_revpi.addItem(spacerItem1)
self.vl_revpi.addLayout(self.hl_revpi)
self.tree_files_revpi = QtWidgets.QTreeWidget(self.gridLayoutWidget_2)
self.tree_files_revpi.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
diff --git a/include/ui/revpicommander_ui.py b/include/ui/revpicommander_ui.py
index 3564b7c..77a3d50 100644
--- a/include/ui/revpicommander_ui.py
+++ b/include/ui/revpicommander_ui.py
@@ -81,7 +81,6 @@ class Ui_win_revpicommander(object):
self.act_program = QtWidgets.QAction(win_revpicommander)
self.act_program.setObjectName("act_program")
self.act_developer = QtWidgets.QAction(win_revpicommander)
- self.act_developer.setCheckable(True)
self.act_developer.setObjectName("act_developer")
self.act_pictory = QtWidgets.QAction(win_revpicommander)
self.act_pictory.setObjectName("act_pictory")
diff --git a/include/ui/revpidevelop_ui.py b/include/ui/revpidevelop_ui.py
deleted file mode 100644
index 59da5e8..0000000
--- a/include/ui/revpidevelop_ui.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'revpidevelop.ui'
-#
-# Created by: PyQt5 UI code generator 5.10.1
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt5 import QtCore, QtGui, QtWidgets
-
-class Ui_wid_develop(object):
- def setupUi(self, wid_develop):
- wid_develop.setObjectName("wid_develop")
- wid_develop.resize(374, 444)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(wid_develop.sizePolicy().hasHeightForWidth())
- wid_develop.setSizePolicy(sizePolicy)
- self.gridLayout = QtWidgets.QGridLayout(wid_develop)
- self.gridLayout.setContentsMargins(0, 0, 0, 0)
- self.gridLayout.setObjectName("gridLayout")
- self.btn_all = QtWidgets.QPushButton(wid_develop)
- self.btn_all.setObjectName("btn_all")
- self.gridLayout.addWidget(self.btn_all, 2, 0, 1, 1)
- self.btn_upload = QtWidgets.QPushButton(wid_develop)
- self.btn_upload.setObjectName("btn_upload")
- self.gridLayout.addWidget(self.btn_upload, 2, 1, 1, 1)
- self.tree_files = QtWidgets.QTreeWidget(wid_develop)
- self.tree_files.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
- self.tree_files.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
- self.tree_files.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
- self.tree_files.setIconSize(QtCore.QSize(24, 24))
- self.tree_files.setObjectName("tree_files")
- self.tree_files.headerItem().setText(0, "1")
- self.tree_files.header().setVisible(False)
- self.gridLayout.addWidget(self.tree_files, 1, 0, 1, 2)
- self.gb_select = QtWidgets.QGroupBox(wid_develop)
- self.gb_select.setObjectName("gb_select")
- self.gridLayout_2 = QtWidgets.QGridLayout(self.gb_select)
- self.gridLayout_2.setObjectName("gridLayout_2")
- self.lbl_select = QtWidgets.QLabel(self.gb_select)
- self.lbl_select.setObjectName("lbl_select")
- self.gridLayout_2.addWidget(self.lbl_select, 0, 0, 1, 1)
- self.btn_select = QtWidgets.QPushButton(self.gb_select)
- icon = QtGui.QIcon()
- icon.addPixmap(QtGui.QPixmap(":/action/ico/folder-open.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
- self.btn_select.setIcon(icon)
- self.btn_select.setIconSize(QtCore.QSize(24, 24))
- self.btn_select.setObjectName("btn_select")
- self.gridLayout_2.addWidget(self.btn_select, 0, 1, 1, 1)
- self.lbl_path = QtWidgets.QLabel(self.gb_select)
- self.lbl_path.setObjectName("lbl_path")
- self.gridLayout_2.addWidget(self.lbl_path, 1, 0, 1, 2)
- self.btn_refresh = QtWidgets.QPushButton(self.gb_select)
- icon1 = QtGui.QIcon()
- icon1.addPixmap(QtGui.QPixmap(":/action/ico/refresh.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
- self.btn_refresh.setIcon(icon1)
- self.btn_refresh.setIconSize(QtCore.QSize(24, 24))
- self.btn_refresh.setObjectName("btn_refresh")
- self.gridLayout_2.addWidget(self.btn_refresh, 0, 2, 1, 1)
- self.gridLayout_2.setColumnStretch(0, 1)
- self.gridLayout.addWidget(self.gb_select, 0, 0, 1, 2)
-
- self.retranslateUi(wid_develop)
- QtCore.QMetaObject.connectSlotsByName(wid_develop)
-
- def retranslateUi(self, wid_develop):
- _translate = QtCore.QCoreApplication.translate
- self.btn_all.setText(_translate("wid_develop", "Stop / Upload / Start"))
- self.btn_upload.setText(_translate("wid_develop", "Just upload"))
- self.gb_select.setTitle(_translate("wid_develop", "File watcher for PLC development"))
- self.lbl_select.setText(_translate("wid_develop", "Path to development root:"))
- self.btn_select.setToolTip(_translate("wid_develop", "Open developer root directory"))
- self.lbl_path.setText(_translate("wid_develop", "/"))
- self.btn_refresh.setToolTip(_translate("wid_develop", "Reload file list"))
-
-from . import ressources_rc
-
-if __name__ == "__main__":
- import sys
- app = QtWidgets.QApplication(sys.argv)
- wid_develop = QtWidgets.QWidget()
- ui = Ui_wid_develop()
- ui.setupUi(wid_develop)
- wid_develop.show()
- sys.exit(app.exec_())
-
diff --git a/include/ui_dev/files.ui b/include/ui_dev/files.ui
index a0983d1..4ed03fa 100644
--- a/include/ui_dev/files.ui
+++ b/include/ui_dev/files.ui
@@ -7,7 +7,7 @@
0
0
725
- 592
+ 519
@@ -23,7 +23,7 @@
false
-
+
-
@@ -94,6 +94,43 @@
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+
+
+
+ :/action/ico/arrow-right.ico:/action/ico/arrow-right.ico
+
+
+
+ 24
+ 24
+
+
+
+ false
+
+
+
+
+
-
@@ -179,26 +216,6 @@
-
-
-
-
-
-
-
-
-
- :/action/ico/arrow-right.ico:/action/ico/arrow-right.ico
-
-
-
- 24
- 24
-
-
-
- false
-
-
-
-
@@ -240,7 +257,7 @@
-
-
+
Qt::Horizontal
diff --git a/include/ui_dev/revpicommander.ui b/include/ui_dev/revpicommander.ui
index 7e3b8cc..4db3533 100644
--- a/include/ui_dev/revpicommander.ui
+++ b/include/ui_dev/revpicommander.ui
@@ -199,9 +199,6 @@
-
- true
-
PLC de&veloper...
diff --git a/include/ui_dev/revpidevelop.ui b/include/ui_dev/revpidevelop.ui
deleted file mode 100644
index e767f88..0000000
--- a/include/ui_dev/revpidevelop.ui
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
- wid_develop
-
-
-
- 0
- 0
- 374
- 444
-
-
-
-
- 0
- 0
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- Stop / Upload / Start
-
-
-
- -
-
-
- Just upload
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
- QAbstractItemView::MultiSelection
-
-
- QAbstractItemView::SelectRows
-
-
-
- 24
- 24
-
-
-
- false
-
-
-
- 1
-
-
-
-
- -
-
-
- File watcher for PLC development
-
-
-
-
-
-
- Path to development root:
-
-
-
- -
-
-
- Open developer root directory
-
-
-
- :/action/ico/folder-open.ico:/action/ico/folder-open.ico
-
-
-
- 24
- 24
-
-
-
-
- -
-
-
- /
-
-
-
- -
-
-
- Reload file list
-
-
-
- :/action/ico/refresh.ico:/action/ico/refresh.ico
-
-
-
- 24
- 24
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/revpicommander/locale/revpicommander_de.ts b/revpicommander/locale/revpicommander_de.ts
index f0e4183..68fc9a7 100644
--- a/revpicommander/locale/revpicommander_de.ts
+++ b/revpicommander/locale/revpicommander_de.ts
@@ -1,6 +1,5 @@
-
-
+
AclManager
@@ -65,27 +64,27 @@ Unsaved changes will be lost
AvahiSearch
-
+
Auto discovered
-
+
Already in list...
-
+
The selected Revolution Pi is already saved in your connection list as '{0}.
-
+
Success
-
+
The connection with the name '{0}' was successfully saved to folder '{1}' in your connections.
@@ -93,7 +92,7 @@ Unsaved changes will be lost
AvahiSearchThread
-
+
N/A
@@ -135,12 +134,12 @@ Unsaved changes will be lost
DebugIos
-
+
signed
-
+
big_endian
@@ -172,22 +171,22 @@ Unsaved changes will be lost!
RevPiCommander
-
+
Select downloaded piCtory file...
-
+
piCtory file (*.rsc);;All files (*.*)
-
+
Simulator started...
-
+
The simulator is running!
You can work with this simulator if your call RevPiModIO with this additional parameters:
@@ -198,164 +197,221 @@ You can copy that from header textbox.
-
+
Can not start...
-
+
Can not start the simulator! Maybe the piCtory file is corrupt or you can not write to the location '{0}'.
-
+
Warning
-
+
This version of Logviewer ist not supported in version {0} of RevPiPyLoad on your RevPi! You need at least version 0.4.1.
-
+
XML-RPC access mode in the RevPiPyLoad configuration is too small to access this dialog!
-
+
Error
-
+
The Version of RevPiPyLoad on your Revolution Pi ({0}) is to old. This Version of RevPiCommander require at least version 0.6.0 of RevPiPyLoad. Please update your Revolution Pi!
-
+
Question
-
+
Are you sure to reset piControl?
The pictory configuration will be reloaded. During that time the process image will be interrupted and could rise errors on running control programs!
-
+
Success
-
+
piControl reset executed successfully
-
+
piControl reset could not be executed successfully
-
+
Can not connect to RevPi XML-RPC Service!
This could have the following reasons: The RevPi is not online, the XML-RPC service is not running or the ACL permission is not set for your IP!!!
-
+
Reset to piCtory defaults...
-
+
Do you want to reset your process image to piCtory default values?
You have to stop other RevPiModIO programs before doing that, because they could reset the outputs.
-
+
The watch mode ist not supported in version {0} of RevPiPyLoad on your RevPi! You need at least version 0.5.3! Maybe the python3-revpimodio2 module is not installed on your RevPi at least version 2.0.0.
-
+
Can not load this function, because your ACL level is to low!
You need at least level 1 to read or level 3 to write.
-
+
Can not load piCtory configuration.
Did you create a hardware configuration? Please check this in piCtory!
- RevPiDevelop
+ RevPiFiles
-
+
Please select...
-
+
Error
-
+
Can not stop plc program on Revolution Pi.
-
+
Information...
-
+
A PLC program has been uploaded. Please check the PLC options to see if the correct program is specified as the start program.
-
+
The Revolution Pi could not process some parts of the transmission.
-
+
Errors occurred during transmission
-
+
Warning
-
+
Could not start the plc program on Revolution Pi.
-
+
+ The RevPiPyLoad version on the Revolution Pi is to old.
+
+
+
+
+ Can not open last directory '{0}'.
+
+
+
+
Stop scanning for files, because we found more than {0} files.
-
+
+ Could not load path of working dir
+
+
+
+
+ Can not load file list from Revolution Pi.
+
+
+
+
Select folder...
-
+
Can not access the folder '{0}' to read files.
+
+
+ Error...
+
+
+
+
+ Error while download file '{0}'.
+
+
+
+
+ Override files...
+
+
+
+
+ One or more files does exist on your computer! Do you want to override the existingfiles?
+
+Select 'Yes' to override, 'No' to download only missing files.
+
+
+
+
+ Delete files from Revolution Pi...
+
+
+
+
+ Do you want to delete {0} files from revolution pi?
+
+
+
+
+ Error while delete file '{0}'.
+
+
RevPiInfo
@@ -487,7 +543,7 @@ Unsaved changes will be lost.
RevPiProgram
-
+
Error
@@ -538,7 +594,7 @@ Please try again.
-
+
Success
@@ -589,176 +645,156 @@ An error occurred on piControl reset!
-
- Select folder...
-
-
-
-
+
Save ZIP archive...
-
+
ZIP archive (*.zip);;All files (*.*)
-
+
Save TGZ archive...
-
+
TGZ archive (*.tgz);;All files (*.*)
-
+
Could not load PLC program from Revolution Pi.
-
+
Coud not save the archive or extract the files!
Please retry.
-
+
Transfer successfully completed.
-
- Upload plc files...
-
-
-
-
- Python file (*.py);;Config file (*.conf);;;JSON file (*.json);;All files (*.*)
-
-
-
-
- Select folder to upload...
-
-
-
-
+
Upload content of ZIP archive...
-
+
The selected file ist not a ZIP archive.
-
+
Upload content of TAR archive...
-
+
TAR archive (*.tgz);;All files (*.*)
-
+
The selected file ist not a TAR archive.
-
+
No files to upload...
-
+
Found no files to upload in given location or archive.
-
+
There was an error deleting the files on the Revolution Pi.
Upload aborted! Please try again.
-
+
The PLC program was transferred successfully.
-
+
Information
-
+
Could not find the selected PLC start program in uploaded files.
This is not an error, if the file was already on the Revolution Pi. Check PLC start program field
-
+
There is no piCtory configuration in this archive.
-
+
The Revolution Pi could not process some parts of the transmission.
-
+
Errors occurred during transmission.
-
+
Save piCtory file...
-
+
piCtory file (*.rsc);;All files (*.*)
-
+
Could not load piCtory file from Revolution Pi.
-
+
piCtory configuration successfully loaded and saved to:
{0}.
-
+
Upload piCtory file...
-
+
Save piControl file...
-
+
Process image file (*.img);;All files (*.*)
-
+
Could not load process image from Revolution Pi.
-
+
Process image successfully loaded and saved to:
{0}.
@@ -1127,61 +1163,51 @@ Publish values with topic: [basetopic]/set/[outputname]
- Files
-
-
-
-
- Folder
-
-
-
-
ZIP archive
-
+
TGZ archive
-
+
Upload
-
+
Download
-
+
Transfair format:
-
+
Including piCtory configuration
-
+
Remove all files on Revolution Pi before upload
-
+
Control files
-
+
piCtory configuraiton
-
+
Process image from piControl0
@@ -1339,44 +1365,6 @@ applicable law.
-
- wid_develop
-
-
- Stop / Upload / Start
-
-
-
-
- Just upload
-
-
-
-
- File watcher for PLC development
-
-
-
-
- Path to development root:
-
-
-
-
- Open developer root directory
-
-
-
-
- /
-
-
-
-
- Reload file list
-
-
-
win_debugios
@@ -1385,6 +1373,54 @@ applicable law.
+
+ win_files
+
+
+ File manager
+
+
+
+
+ Local computer
+
+
+
+
+ Path to development root:
+
+
+
+
+ Open developer root directory
+
+
+
+
+ Reload file list
+
+
+
+
+ /
+
+
+
+
+ Revolution Pi
+
+
+
+
+ RevPiPyLoad working directory:
+
+
+
+
+ Stop - Upload - Start
+
+
+
win_revpicommander
@@ -1498,37 +1534,37 @@ applicable law.
-
+
PLC de&veloper...
-
+
F9
-
+
piCtory configuraiton...
-
+
&Disconnect
-
+
Ctrl+X
-
+
Reset driver...
-
+
Start local si&mulator...
diff --git a/revpicommander/revpicommander.py b/revpicommander/revpicommander.py
index 951c481..234bae7 100755
--- a/revpicommander/revpicommander.py
+++ b/revpicommander/revpicommander.py
@@ -40,10 +40,6 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
self.dict_men_connections_subfolder = {}
"""Submenus for folder entries."""
- # fixme: Prepare gui
- #self.__base_size = self.size()
- #self.setFixedSize(self.__base_size)
-
self._set_gui_control_states()
self._load_men_connections()
@@ -115,7 +111,6 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
# This will remove the widgets in the button functions
self.btn_plc_debug.setChecked(False)
- self.act_developer.setChecked(False)
self.diag_info.reject()
self.diag_options.reject()
@@ -312,8 +307,8 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
self.diag_program.exec()
- @QtCore.pyqtSlot(bool)
- def on_act_developer_toggled(self, state: bool):
+ @QtCore.pyqtSlot()
+ def on_act_developer_triggered(self):
"""Extent developer mode to main window."""
if not helper.cm.connected:
return
diff --git a/revpicommander/revpidevelop.py b/revpicommander/revpidevelop.py
deleted file mode 100644
index 3ae144f..0000000
--- a/revpicommander/revpidevelop.py
+++ /dev/null
@@ -1,299 +0,0 @@
-# -*- coding: utf-8 -*-
-"""PLC developer to upload your active development."""
-__author__ = "Sven Sager"
-__copyright__ = "Copyright (C) 2018 Sven Sager"
-__license__ = "GPLv3"
-
-import gzip
-import os
-from enum import IntEnum
-from os import DirEntry
-from xmlrpc.client import Binary
-
-from PyQt5 import QtCore, QtGui, QtWidgets
-
-import helper
-import proginit as pi
-from helper import WidgetData
-from ui.revpidevelop_ui import Ui_wid_develop
-
-
-class NodeType(IntEnum):
- FILE = 1000
- DIR = 1001
-
-
-class RevPiDevelop(QtWidgets.QWidget, Ui_wid_develop):
- """Developer extension for RevPiCommander."""
-
- def __init__(self, parent=None):
- super(RevPiDevelop, self).__init__(parent)
- self.setupUi(self)
-
- self.tree_files_counter = 0
- self.tree_files_counter_max = 10000
- self.lbl_path.setText(helper.cm.develop_watch_path or self.tr("Please select..."))
-
- self.btn_all.setEnabled(False)
- self.btn_upload.setEnabled(False)
-
- if helper.cm.develop_watch_path:
- self._load_path_files(True)
-
- def __del__(self):
- pi.logger.debug("RevPiDevelop.__del__")
-
- def _do_my_job(self, stop_restart=True):
- """
- Upload the selected files and do a optionally restart.
-
- :param stop_restart: True will restart program
- """
- if not helper.cm.connected:
- return
-
- if stop_restart and helper.cm.call_remote_function("plcstop") is None:
- QtWidgets.QMessageBox.critical(
- self, self.tr("Error"), self.tr(
- "Can not stop plc program on Revolution Pi."
- )
- )
- return
-
- # Get config to find actual auto start program for warnings
- opt_program = helper.cm.call_remote_function("get_config", default_value={})
- opt_program = opt_program.get("plcprogram", "none.py")
- uploaded = True # Will be False, when opt_program was found in files
- ec = 0
-
- for file_name in self.file_list():
- # todo: Check exception of local file
- with open(file_name, "rb") as fh:
- # Remove base dir of file to set relative for PyLoad
- send_name = file_name.replace(helper.cm.develop_watch_path, "")[1:]
-
- # Check whether this is the auto start program
- if send_name == opt_program:
- uploaded = False
-
- # Transfer file
- try:
- upload_status = helper.cm.call_remote_function(
- "plcupload", Binary(gzip.compress(fh.read())), send_name,
- default_value=False
- )
- except Exception as e:
- pi.logger.error(e)
- ec = -2
- break
-
- if not upload_status:
- ec = -1
- break
-
- if ec == 0:
- # Tell user, we did not find the auto start program in files
- if uploaded:
- QtWidgets.QMessageBox.information(
- self, self.tr("Information..."), self.tr(
- "A PLC program has been uploaded. Please check the "
- "PLC options to see if the correct program is "
- "specified as the start program."
- )
- )
-
- elif ec == -1:
- QtWidgets.QMessageBox.critical(
- self, self.tr("Error"), self.tr(
- "The Revolution Pi could not process some parts of the "
- "transmission."
- )
- )
-
- elif ec == -2:
- QtWidgets.QMessageBox.critical(
- self, self.tr("Error"),
- self.tr("Errors occurred during transmission")
- )
-
- if stop_restart and helper.cm.call_remote_function("plcstart", default_value=1) != 0:
- QtWidgets.QMessageBox.warning(
- self, self.tr("Warning"), self.tr(
- "Could not start the plc program on Revolution Pi."
- )
- )
-
- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
- # region # REGION: Tree management
-
- def __insert_files(self, base_dir: str, child=None):
- """
- Recursively add files to tree view.
-
- :param base_dir: Directory to scan for files
- :param child: Child widget to add new widgets
- """
- for de in os.scandir(base_dir): # type: DirEntry
-
- if self.tree_files_counter > self.tree_files_counter_max:
- return
-
- if de.is_dir(follow_symlinks=False):
- item = QtWidgets.QTreeWidgetItem(NodeType.DIR)
- item.setText(0, de.name)
- item.setIcon(0, QtGui.QIcon(":/main/ico/folder.ico"))
- if child:
- child.addChild(item)
- else:
- self.tree_files.addTopLevelItem(item)
-
- self.__insert_files(de.path, item)
-
- elif de.is_file(follow_symlinks=False):
- self.tree_files_counter += 1
-
- item = QtWidgets.QTreeWidgetItem(NodeType.FILE)
- item.setText(0, de.name)
- item.setData(0, WidgetData.file_name, de.path)
- item.setIcon(0, QtGui.QIcon(
- ":/file/ico/file-else.ico" if de.name.find(".py") == -1 else
- ":/file/ico/file-python.ico"
- ))
- if child:
- child.addChild(item)
- else:
- self.tree_files.addTopLevelItem(item)
-
- item.setSelected(de.path in helper.cm.develop_watch_files)
- self._parent_selected(item)
-
- def __select_children(self, top_item: QtWidgets.QTreeWidgetItem, value: bool):
- """Recursive select files from directory."""
- pi.logger.debug("RevPiDevelop.__select_children")
-
- for i in range(top_item.childCount()):
- item = top_item.child(i)
- if item.type() == NodeType.DIR:
- self.__select_children(item, value)
- elif item.type() == NodeType.FILE:
- item.setSelected(value)
-
- def _load_path_files(self, silent=False):
- """
- Refresh the file list.
-
- :param silent: Do not show message boxes
- """
- pi.logger.debug("RevPiDevelop._load_path_files")
-
- self.tree_files_counter = 0
- self.tree_files.blockSignals(True)
- self.tree_files.clear()
- self.tree_files.blockSignals(False)
-
- self.__insert_files(helper.cm.develop_watch_path)
- self.tree_files.sortItems(0, QtCore.Qt.AscendingOrder)
-
- if not silent and self.tree_files_counter > self.tree_files_counter_max:
- QtWidgets.QMessageBox.critical(
- self, self.tr("Error"), self.tr(
- "Stop scanning for files, because we found more than {0} files."
- ).format(self.tree_files_counter_max)
- )
-
- state = len(self.tree_files.selectedItems()) > 0
- self.btn_all.setEnabled(state)
- self.btn_upload.setEnabled(state)
-
- def _parent_selected(self, item: QtWidgets.QTreeWidgetItem):
- """Check all children of a parent are selected."""
- if item.parent():
- all_selected = True
- for i in range(item.parent().childCount()):
- if not item.parent().child(i).isSelected():
- all_selected = False
- break
- item.parent().setSelected(all_selected)
-
- def file_list(self):
- """Generate a file list with full path of selected entries."""
- pi.logger.debug("RevPiDevelop.file_list")
- lst = []
- for item in self.tree_files.selectedItems():
- if item.type() == NodeType.DIR:
- continue
- lst.append(item.data(0, WidgetData.file_name))
-
- return lst
-
- @QtCore.pyqtSlot()
- def on_tree_files_itemSelectionChanged(self):
- item = self.tree_files.currentItem()
- if item is None:
- return
-
- pi.logger.debug("RevPiDevelop.on_tree_files_itemSelectionChanged")
-
- # Block while preselect other entries
- self.tree_files.blockSignals(True)
-
- if item.type() == NodeType.DIR:
- self.__select_children(item, item.isSelected())
-
- elif item.type() == NodeType.FILE:
- self._parent_selected(item)
-
- self.tree_files.blockSignals(False)
-
- state = len(self.tree_files.selectedItems()) > 0
- self.btn_all.setEnabled(state)
- self.btn_upload.setEnabled(state)
-
- helper.cm.develop_watch_files = self.file_list()
-
- # endregion # # # # #
-
- @QtCore.pyqtSlot()
- def on_btn_all_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_all_pressed")
- self._do_my_job(True)
-
- @QtCore.pyqtSlot()
- def on_btn_select_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_select_pressed")
-
- diag_folder = QtWidgets.QFileDialog(
- self, self.tr("Select folder..."),
- helper.cm.develop_watch_path,
- )
- diag_folder.setFileMode(QtWidgets.QFileDialog.DirectoryOnly)
- if diag_folder.exec() != QtWidgets.QFileDialog.Accepted:
- return
-
- selected_dir = diag_folder.selectedFiles()[0]
-
- if not os.access(selected_dir, os.R_OK):
- QtWidgets.QMessageBox.critical(
- self, self.tr("Error"), self.tr(
- "Can not access the folder '{0}' to read files."
- )
- )
- helper.cm.develop_watch_files = []
- helper.cm.develop_watch_path = ""
- return
-
- self.lbl_path.setText(selected_dir)
- helper.cm.develop_watch_path = selected_dir
- helper.cm.develop_watch_files = []
-
- self._load_path_files(False)
-
- @QtCore.pyqtSlot()
- def on_btn_refresh_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_refresh_pressed")
- self._load_path_files(False)
-
- @QtCore.pyqtSlot()
- def on_btn_upload_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_upload_pressed")
- self._do_my_job(False)
diff --git a/revpicommander/revpifiles.py b/revpicommander/revpifiles.py
index f9a2d48..ea6a7c0 100644
--- a/revpicommander/revpifiles.py
+++ b/revpicommander/revpifiles.py
@@ -409,7 +409,7 @@ class RevPiFiles(QtWidgets.QMainWindow, Ui_win_files):
@QtCore.pyqtSlot()
def on_btn_all_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_all_pressed")
+ pi.logger.debug("RevPiFiles.on_btn_all_pressed")
self._do_my_job(True)
self.file_list_revpi()
@@ -446,25 +446,25 @@ class RevPiFiles(QtWidgets.QMainWindow, Ui_win_files):
@QtCore.pyqtSlot()
def on_btn_refresh_local_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_refresh_pressed")
+ pi.logger.debug("RevPiFiles.on_btn_refresh_pressed")
self._load_files_local(False)
@QtCore.pyqtSlot()
def on_btn_refresh_revpi_pressed(self):
- pi.logger.debug("RevPiDevelop.on_btn_refresh_revpi_pressed")
+ pi.logger.debug("RevPiFiles.on_btn_refresh_revpi_pressed")
self._load_files_revpi(False)
@QtCore.pyqtSlot()
def on_btn_to_right_pressed(self):
"""Upload selected files to revolution pi."""
- pi.logger.debug("RevPiDevelop.on_btn_to_right_pressed")
+ pi.logger.debug("RevPiFiles.on_btn_to_right_pressed")
self._do_my_job(False)
self.file_list_revpi()
@QtCore.pyqtSlot()
def on_btn_to_left_pressed(self):
"""Download selected file."""
- pi.logger.debug("RevPiDevelop.on_btn_to_left_pressed")
+ pi.logger.debug("RevPiFiles.on_btn_to_left_pressed")
override = None
for item in self.tree_files_revpi.selectedItems():
@@ -511,7 +511,7 @@ class RevPiFiles(QtWidgets.QMainWindow, Ui_win_files):
@QtCore.pyqtSlot()
def on_btn_delete_revpi_pressed(self):
"""Remove selected files from working directory on revolution pi."""
- pi.logger.debug("RevPiDevelop.btn_delete_revpi_pressed")
+ pi.logger.debug("RevPiFiles.btn_delete_revpi_pressed")
lst_delete = []
for item in self.tree_files_revpi.selectedItems():
diff --git a/translate.pro b/translate.pro
index 3c9a11c..bd16c3f 100644
--- a/translate.pro
+++ b/translate.pro
@@ -3,7 +3,7 @@ SOURCES = revpicommander/aclmanager.py \
revpicommander/debugcontrol.py \
revpicommander/debugios.py \
revpicommander/mqttmanager.py \
- revpicommander/revpidevelop.py \
+ revpicommander/revpifiles.py \
revpicommander/revpiinfo.py \
revpicommander/revpilogfile.py \
revpicommander/revpioption.py \
@@ -16,7 +16,7 @@ FORMS = include/ui_dev/aclmanager.ui \
include/ui_dev/debugcontrol.ui \
include/ui_dev/debugios.ui \
include/ui_dev/mqttmanager.ui \
- include/ui_dev/revpidevelop.ui \
+ include/ui_dev/files.ui \
include/ui_dev/revpiinfo.ui \
include/ui_dev/revpilogfile.ui \
include/ui_dev/revpioption.ui \