Update "Network Status" information only when the tab selected
This commit is contained in:
parent
03f08b3cfd
commit
85cce42de0
|
@ -686,6 +686,10 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
||||
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
||||
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
||||
QtCore.QObject.connect(
|
||||
self.ui.tabWidget, QtCore.SIGNAL("currentChanged(int)"),
|
||||
self.tabWidgetCurrentChanged
|
||||
)
|
||||
|
||||
# Put the colored icon on the status bar
|
||||
# self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
|
||||
|
@ -4012,6 +4016,12 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
completerList[i] = item.label + " <" + item.address + ">"
|
||||
self.ui.lineEditTo.completer().model().setStringList(completerList)
|
||||
|
||||
def tabWidgetCurrentChanged(self, n):
|
||||
if n == self.ui.tabWidget.indexOf(self.ui.networkstatus):
|
||||
self.ui.networkstatus.startUpdate()
|
||||
else:
|
||||
self.ui.networkstatus.stopUpdate()
|
||||
|
||||
def writeNewAddressToTable(self, label, address, streamNumber):
|
||||
self.rerenderTabTreeMessages()
|
||||
self.rerenderTabTreeSubscriptions()
|
||||
|
|
|
@ -41,8 +41,16 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
|||
"updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.updateNetworkStatusTab)
|
||||
|
||||
self.timer = QtCore.QTimer()
|
||||
self.timer.start(2000) # milliseconds
|
||||
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
||||
|
||||
QtCore.QObject.connect(
|
||||
self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
||||
|
||||
def startUpdate(self):
|
||||
self.runEveryTwoSeconds()
|
||||
self.timer.start(2000) # milliseconds
|
||||
|
||||
def stopUpdate(self):
|
||||
self.timer.stop()
|
||||
|
||||
def formatBytes(self, num):
|
||||
for x in [_translate("networkstatus", "byte(s)", None, QtCore.QCoreApplication.CodecForTr, num), "kB", "MB", "GB"]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user