MqttMonitor/MqttMonitorWidget.py

branch
eric7
changeset 127
8982ef7b7d67
parent 123
3d7e63ed4fd1
child 129
9d54bf366323
--- a/MqttMonitor/MqttMonitorWidget.py	Wed Sep 21 09:46:48 2022 +0200
+++ b/MqttMonitor/MqttMonitorWidget.py	Mon Oct 24 18:01:45 2022 +0200
@@ -16,9 +16,15 @@
 from PyQt6.QtGui import QFont, QTextCursor, QBrush, QColor
 from PyQt6.QtWidgets import QWidget, QDialog, QMenu
 
-from EricWidgets.EricApplication import ericApp
-from EricWidgets import EricMessageBox, EricFileDialog
-from EricWidgets.EricPathPicker import EricPathPickerModes
+from eric7 import Utilities
+
+try:
+    from eric7.EricGui import EricPixmapCache
+except ImportError:
+    from UI import PixmapCache as EricPixmapCache
+from eric7.EricWidgets import EricMessageBox, EricFileDialog
+from eric7.EricWidgets.EricApplication import ericApp
+from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
 
 from .Ui_MqttMonitorWidget import Ui_MqttMonitorWidget
 
@@ -31,9 +37,6 @@
 from .MqttReasonCodes import mqttReasonCode
 from .MqttProtocols import MqttProtocols
 
-import UI.PixmapCache
-import Utilities
-
 
 class MqttMonitorWidget(QWidget, Ui_MqttMonitorWidget):
     """
@@ -71,7 +74,7 @@
             # backward compatibility
             if not ericApp().usesSmallScreen():
                 self.pixmapLabel.setPixmap(
-                    UI.PixmapCache.getPixmap(
+                    EricPixmapCache.getPixmap(
                         os.path.join(
                             "MqttMonitor",
                             "icons",
@@ -149,9 +152,9 @@
         self.__setConnectionMode(True)  # initial mode is 'profile connection'
         self.__populateProfileComboBox()
 
-        self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect"))
+        self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
         self.brokerConnectionOptionsButton.setIcon(
-            UI.PixmapCache.getIcon(
+            EricPixmapCache.getIcon(
                 os.path.join(
                     "MqttMonitor",
                     "icons",
@@ -161,7 +164,7 @@
         )
         self.__populateBrokerComboBoxes()
         self.brokerStatusLabel.hide()
-        self.clearWillButton.setIcon(UI.PixmapCache.getIcon("certificateDelete"))
+        self.clearWillButton.setIcon(EricPixmapCache.getIcon("certificateDelete"))
 
         self.subscribeTopicComboBox.lineEdit().setClearButtonEnabled(True)
         self.subscribeTopicComboBox.lineEdit().returnPressed.connect(
@@ -169,16 +172,16 @@
         )
         self.__populateSubscribeTopicComboBox()
 
-        self.subscribeButton.setIcon(UI.PixmapCache.getIcon("plus"))
+        self.subscribeButton.setIcon(EricPixmapCache.getIcon("plus"))
         self.subscribeButton.setEnabled(False)
-        self.subscribePropertiesButton.setIcon(UI.PixmapCache.getIcon("listSelection"))
+        self.subscribePropertiesButton.setIcon(EricPixmapCache.getIcon("listSelection"))
         self.subscribePropertiesButton.setEnabled(False)
         self.subscribePropertiesButton.setVisible(False)
 
-        self.unsubscribeButton.setIcon(UI.PixmapCache.getIcon("minus"))
+        self.unsubscribeButton.setIcon(EricPixmapCache.getIcon("minus"))
         self.unsubscribeButton.setEnabled(False)
         self.unsubscribePropertiesButton.setIcon(
-            UI.PixmapCache.getIcon("listSelection")
+            EricPixmapCache.getIcon("listSelection")
         )
         self.unsubscribePropertiesButton.setEnabled(False)
         self.unsubscribePropertiesButton.setVisible(False)
@@ -192,7 +195,7 @@
         self.__publishedTopics = []
         self.__updatePublishTopicComboBox()
         self.publishButton.setEnabled(False)
-        self.publishPropertiesButton.setIcon(UI.PixmapCache.getIcon("listSelection"))
+        self.publishPropertiesButton.setIcon(EricPixmapCache.getIcon("listSelection"))
         self.publishPropertiesButton.setEnabled(False)
         self.publishPropertiesButton.setVisible(False)
 
@@ -283,19 +286,19 @@
         """
         self.__propertiesEditMenu = QMenu(self)
         self.__copyPropertiesAct = self.__propertiesEditMenu.addAction(
-            UI.PixmapCache.getIcon("editCopy"),
+            EricPixmapCache.getIcon("editCopy"),
             self.tr("Copy"),
             self.propertiesEdit.copy,
         )
         self.__propertiesEditMenu.addSeparator()
         self.__selectAllPropertiesAct = self.__propertiesEditMenu.addAction(
-            UI.PixmapCache.getIcon("editSelectAll"),
+            EricPixmapCache.getIcon("editSelectAll"),
             self.tr("Select All"),
             self.propertiesEdit.selectAll,
         )
         self.__propertiesEditMenu.addSeparator()
         self.__clearPropertiesAct = self.__propertiesEditMenu.addAction(
-            UI.PixmapCache.getIcon("editDelete"),
+            EricPixmapCache.getIcon("editDelete"),
             self.tr("Clear"),
             self.propertiesEdit.clear,
         )
@@ -352,7 +355,7 @@
             self.__connectedToBroker = True
             self.__connectionOptions = None
 
-            self.connectButton.setIcon(UI.PixmapCache.getIcon("ircDisconnect"))
+            self.connectButton.setIcon(EricPixmapCache.getIcon("ircDisconnect"))
 
             self.subscribeGroup.setEnabled(True)
             self.subscribePropertiesButton.setVisible(
@@ -412,7 +415,7 @@
         )
         self.__flashBrokerStatusLabel(msg)
 
-        self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect"))
+        self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
         self.__setConnectButtonState()
 
         self.__subscribedTopics = []
@@ -1329,7 +1332,7 @@
         self.__connectionModeProfile = profileMode
         if profileMode:
             self.modeButton.setIcon(
-                UI.PixmapCache.getIcon(
+                EricPixmapCache.getIcon(
                     os.path.join(
                         "MqttMonitor", "icons", "profiles-{0}".format(self.__iconSuffix)
                     )
@@ -1337,7 +1340,7 @@
             )
         else:
             self.modeButton.setIcon(
-                UI.PixmapCache.getIcon(
+                EricPixmapCache.getIcon(
                     os.path.join(
                         "MqttMonitor",
                         "icons",

eric ide

mercurial