mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
Redesign main window with text boxes to copy host name or ip
This commit is contained in:
@@ -14,45 +14,63 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
class Ui_win_revpicommander(object):
|
||||
def setupUi(self, win_revpicommander):
|
||||
win_revpicommander.setObjectName("win_revpicommander")
|
||||
win_revpicommander.resize(318, 273)
|
||||
win_revpicommander.resize(353, 299)
|
||||
win_revpicommander.setWindowTitle("RevPi Commander")
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(":/main/ico/revpipycontrol.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
win_revpicommander.setWindowIcon(icon)
|
||||
self.centralwidget = QtWidgets.QWidget(win_revpicommander)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.gl = QtWidgets.QGridLayout(self.centralwidget)
|
||||
self.gl.setObjectName("gl")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.hzl_connection = QtWidgets.QHBoxLayout()
|
||||
self.hzl_connection.setObjectName("hzl_connection")
|
||||
self.txt_host = QtWidgets.QLineEdit(self.centralwidget)
|
||||
self.txt_host.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.txt_host.setText("")
|
||||
self.txt_host.setReadOnly(True)
|
||||
self.txt_host.setObjectName("txt_host")
|
||||
self.hzl_connection.addWidget(self.txt_host)
|
||||
self.txt_connection = QtWidgets.QLineEdit(self.centralwidget)
|
||||
self.txt_connection.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.txt_connection.setText("")
|
||||
self.txt_connection.setReadOnly(True)
|
||||
self.txt_connection.setObjectName("txt_connection")
|
||||
self.gl.addWidget(self.txt_connection, 0, 0, 1, 1)
|
||||
self.hzl_connection.addWidget(self.txt_connection)
|
||||
self.verticalLayout.addLayout(self.hzl_connection)
|
||||
self.btn_plc_start = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn_plc_start.setObjectName("btn_plc_start")
|
||||
self.gl.addWidget(self.btn_plc_start, 1, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.btn_plc_start)
|
||||
self.btn_plc_stop = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn_plc_stop.setObjectName("btn_plc_stop")
|
||||
self.gl.addWidget(self.btn_plc_stop, 2, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.btn_plc_stop)
|
||||
self.btn_plc_restart = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn_plc_restart.setObjectName("btn_plc_restart")
|
||||
self.gl.addWidget(self.btn_plc_restart, 3, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.btn_plc_restart)
|
||||
self.btn_plc_logs = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn_plc_logs.setObjectName("btn_plc_logs")
|
||||
self.gl.addWidget(self.btn_plc_logs, 4, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.btn_plc_logs)
|
||||
self.hzl_status = QtWidgets.QHBoxLayout()
|
||||
self.hzl_status.setObjectName("hzl_status")
|
||||
self.lbl_status = QtWidgets.QLabel(self.centralwidget)
|
||||
self.lbl_status.setObjectName("lbl_status")
|
||||
self.hzl_status.addWidget(self.lbl_status)
|
||||
self.txt_status = QtWidgets.QLineEdit(self.centralwidget)
|
||||
self.txt_status.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.txt_status.setText("")
|
||||
self.txt_status.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.txt_status.setReadOnly(True)
|
||||
self.txt_status.setObjectName("txt_status")
|
||||
self.gl.addWidget(self.txt_status, 5, 0, 1, 1)
|
||||
self.hzl_status.addWidget(self.txt_status)
|
||||
self.verticalLayout.addLayout(self.hzl_status)
|
||||
self.btn_plc_debug = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn_plc_debug.setMinimumSize(QtCore.QSize(300, 0))
|
||||
self.btn_plc_debug.setCheckable(True)
|
||||
self.btn_plc_debug.setObjectName("btn_plc_debug")
|
||||
self.gl.addWidget(self.btn_plc_debug, 6, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.btn_plc_debug)
|
||||
win_revpicommander.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(win_revpicommander)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 318, 22))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 353, 24))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.men_file = QtWidgets.QMenu(self.menubar)
|
||||
self.men_file.setObjectName("men_file")
|
||||
@@ -126,11 +144,11 @@ class Ui_win_revpicommander(object):
|
||||
|
||||
def retranslateUi(self, win_revpicommander):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
win_revpicommander.setWindowTitle(_translate("win_revpicommander", "RevPi Python PLC Commander"))
|
||||
self.btn_plc_start.setText(_translate("win_revpicommander", "PLC &start"))
|
||||
self.btn_plc_stop.setText(_translate("win_revpicommander", "PLC s&top"))
|
||||
self.btn_plc_restart.setText(_translate("win_revpicommander", "PLC restart"))
|
||||
self.btn_plc_logs.setText(_translate("win_revpicommander", "PLC &logs"))
|
||||
self.lbl_status.setText(_translate("win_revpicommander", "Status:"))
|
||||
self.btn_plc_debug.setText(_translate("win_revpicommander", "PLC watch &mode"))
|
||||
self.men_file.setTitle(_translate("win_revpicommander", "&File"))
|
||||
self.men_help.setTitle(_translate("win_revpicommander", "&Help"))
|
||||
|
||||
@@ -7,71 +7,105 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>318</width>
|
||||
<height>273</height>
|
||||
<width>353</width>
|
||||
<height>299</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>RevPi Python PLC Commander</string>
|
||||
<string notr="true">RevPi Commander</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="ressources.qrc">
|
||||
<normaloff>:/main/ico/revpipycontrol.ico</normaloff>:/main/ico/revpipycontrol.ico</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gl">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="txt_connection">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hzl_connection">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txt_host">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txt_connection">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_plc_start">
|
||||
<property name="text">
|
||||
<string>PLC &start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_plc_stop">
|
||||
<property name="text">
|
||||
<string>PLC s&top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_plc_restart">
|
||||
<property name="text">
|
||||
<string>PLC restart</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_plc_logs">
|
||||
<property name="text">
|
||||
<string>PLC &logs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLineEdit" name="txt_status">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hzl_status">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_status">
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txt_status">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_plc_debug">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -94,8 +128,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>318</width>
|
||||
<height>22</height>
|
||||
<width>353</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="men_file">
|
||||
|
||||
@@ -63,6 +63,8 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
|
||||
|
||||
self.restoreGeometry(helper.settings.value("geo", b''))
|
||||
|
||||
self.setWindowFlag(QtCore.Qt.WindowMaximizeButtonHint, False)
|
||||
|
||||
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
||||
pi.logger.debug("RevPiCommander.closeEvent")
|
||||
helper.cm.pyload_disconnect()
|
||||
@@ -122,6 +124,8 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
|
||||
pi.logger.debug("RevPiCommander.on_cm_connection_disconnected")
|
||||
|
||||
self._set_gui_control_states()
|
||||
self.txt_host.setVisible(True)
|
||||
self.txt_host.clear()
|
||||
self.txt_connection.clear()
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
@@ -148,16 +152,14 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
|
||||
|
||||
self._set_gui_control_states()
|
||||
if helper.cm.simulating:
|
||||
self.txt_host.setVisible(False)
|
||||
self.txt_connection.setText("configrsc=\"{0}\", procimg=\"{1}\"".format(
|
||||
helper.cm.simulating_configrsc,
|
||||
helper.cm.simulating_procimg,
|
||||
))
|
||||
else:
|
||||
self.txt_connection.setText("{0} - {1}:{2}".format(
|
||||
helper.cm.name,
|
||||
helper.cm.address,
|
||||
helper.cm.port
|
||||
))
|
||||
self.txt_host.setText(helper.cm.name)
|
||||
self.txt_connection.setText(helper.cm.address)
|
||||
self.win_files = RevPiFiles(self)
|
||||
|
||||
@QtCore.pyqtSlot(str, str)
|
||||
|
||||
Reference in New Issue
Block a user