本文整理汇总了Python中systray.Systray.setCounter方法的典型用法代码示例。如果您正苦于以下问题:Python Systray.setCounter方法的具体用法?Python Systray.setCounter怎么用?Python Systray.setCounter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类systray.Systray
的用法示例。
在下文中一共展示了Systray.setCounter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScudCloud
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setCounter [as 别名]
#.........这里部分代码省略.........
index = -1
for i in range(0, self.stackedWidget.count()):
if self.stackedWidget.widget(i).url().toString().startswith(url):
index = i
break
if index != -1:
self.stackedWidget.setCurrentIndex(index)
else:
webView = Wrapper(self)
webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
webView.load(QtCore.QUrl(url))
webView.show()
self.stackedWidget.addWidget(webView)
self.stackedWidget.setCurrentWidget(webView)
self.quicklist(self.current().listChannels())
self.enableMenus(self.current().isConnected())
def eventFilter(self, obj, event):
if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow():
self.focusInEvent(event)
if event.type() == QtCore.QEvent.KeyPress and QtGui.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
if event.key() == QtCore.Qt.Key_1: self.leftPane.click(0)
elif event.key() == QtCore.Qt.Key_2: self.leftPane.click(1)
elif event.key() == QtCore.Qt.Key_3: self.leftPane.click(2)
elif event.key() == QtCore.Qt.Key_4: self.leftPane.click(3)
elif event.key() == QtCore.Qt.Key_5: self.leftPane.click(4)
elif event.key() == QtCore.Qt.Key_6: self.leftPane.click(5)
elif event.key() == QtCore.Qt.Key_7: self.leftPane.click(6)
elif event.key() == QtCore.Qt.Key_8: self.leftPane.click(7)
elif event.key() == QtCore.Qt.Key_9: self.leftPane.click(8)
return QtGui.QMainWindow.eventFilter(self, obj, event);
def focusInEvent(self, event):
self.launcher.set_property("urgent", False)
self.tray.stopAlert()
def titleChanged(self):
self.setWindowTitle(self.current().title())
def closeEvent(self, event):
if not self.forceClose and self.settings.value("Systray") == "True":
self.hide()
event.ignore()
else:
self.cookiesjar.save()
self.settings.setValue("geometry", self.saveGeometry())
self.settings.setValue("windowState", self.saveState())
def show(self):
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
self.setVisible(True)
def exit(self):
self.forceClose = True
self.close()
def quicklist(self, channels):
if Dbusmenu is not None:
ql = Dbusmenu.Menuitem.new()
self.launcher.set_property("quicklist", ql)
if channels is not None:
for c in channels:
if c['is_member']:
item = Dbusmenu.Menuitem.new ()
item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "#"+c['name'])
item.property_set ("id", c['name'])
item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
ql.child_append(item)
self.launcher.set_property("quicklist", ql)
def notify(self, title, message):
self.notifier.notify(title, message)
self.alert()
def alert(self):
if not self.isActiveWindow():
self.launcher.set_property("urgent", True)
self.tray.alert()
def count(self):
total = 0
for i in range(0, self.stackedWidget.count()):
widget = self.stackedWidget.widget(i)
if widget.messages == 0:
self.leftPane.stopAlert(widget.team())
else:
self.leftPane.alert(widget.team())
total+=widget.messages
if total > self.messages:
self.alert()
if 0 == total:
self.launcher.set_property("count_visible", False)
self.tray.setCounter(0)
else:
self.tray.setCounter(total)
self.launcher.set_property("count", total)
self.launcher.set_property("count_visible", True)
self.messages = total
示例2: zcswebapp
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setCounter [as 别名]
#.........这里部分代码省略.........
else:
webView = Wrapper(self)
webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
webView.load(qUrl)
webView.show()
self.stackedWidget.addWidget(webView)
self.stackedWidget.setCurrentWidget(webView)
self.quicklist(self.current().listChannels())
self.enableMenus(self.current().isConnected())
# Save the last used team as default
self.settings.setValue("Domain", 'https://'+qUrl.host())
def eventFilter(self, obj, event):
if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow():
self.focusInEvent(event)
if event.type() == QtCore.QEvent.KeyPress:
# Ctrl + <n>
if QtGui.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
if event.key() == QtCore.Qt.Key_1: self.leftPane.click(0)
elif event.key() == QtCore.Qt.Key_2: self.leftPane.click(1)
elif event.key() == QtCore.Qt.Key_3: self.leftPane.click(2)
elif event.key() == QtCore.Qt.Key_4: self.leftPane.click(3)
elif event.key() == QtCore.Qt.Key_5: self.leftPane.click(4)
elif event.key() == QtCore.Qt.Key_6: self.leftPane.click(5)
elif event.key() == QtCore.Qt.Key_7: self.leftPane.click(6)
elif event.key() == QtCore.Qt.Key_8: self.leftPane.click(7)
elif event.key() == QtCore.Qt.Key_9: self.leftPane.click(8)
# Ctrl + Shift + <key>
if (QtGui.QApplication.keyboardModifiers() & QtCore.Qt.ShiftModifier) and (QtGui.QApplication.keyboardModifiers() & QtCore.Qt.ShiftModifier):
if event.key() == QtCore.Qt.Key_V: self.current().createSnippet()
return QtGui.QMainWindow.eventFilter(self, obj, event);
def focusInEvent(self, event):
self.launcher.set_property("urgent", False)
self.tray.stopAlert()
def titleChanged(self):
self.setWindowTitle(self.current().title())
def closeEvent(self, event):
if not self.forceClose and self.settings.value("Systray") == "True":
self.hide()
event.ignore()
else:
self.cookiesjar.save()
self.settings.setValue("geometry", self.saveGeometry())
self.settings.setValue("windowState", self.saveState())
def show(self):
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
self.setVisible(True)
def exit(self):
self.forceClose = True
self.close()
def quicklist(self, channels):
if Dbusmenu is not None:
ql = Dbusmenu.Menuitem.new()
self.launcher.set_property("quicklist", ql)
if channels is not None:
for c in channels:
if c['is_member']:
item = Dbusmenu.Menuitem.new ()
item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "#"+c['name'])
item.property_set ("id", c['name'])
item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
ql.child_append(item)
self.launcher.set_property("quicklist", ql)
def notify(self, title, message):
self.notifier.notify(title, message)
self.alert()
def alert(self):
if not self.isActiveWindow():
self.launcher.set_property("urgent", True)
self.tray.alert()
def count(self):
total = 0
for i in range(0, self.stackedWidget.count()):
widget = self.stackedWidget.widget(i)
if widget.messages == 0:
self.leftPane.stopAlert(widget.team())
else:
self.leftPane.alert(widget.team())
total+=widget.messages
if total > self.messages:
self.alert()
if 0 == total:
self.launcher.set_property("count_visible", False)
self.tray.setCounter(0)
else:
self.tray.setCounter(total)
self.launcher.set_property("count", total)
self.launcher.set_property("count_visible", True)
self.messages = total
示例3: ScudCloud
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setCounter [as 别名]
#.........这里部分代码省略.........
self.leftPane.click(2)
elif event.key() == QtCore.Qt.Key_4:
self.leftPane.click(3)
elif event.key() == QtCore.Qt.Key_5:
self.leftPane.click(4)
elif event.key() == QtCore.Qt.Key_6:
self.leftPane.click(5)
elif event.key() == QtCore.Qt.Key_7:
self.leftPane.click(6)
elif event.key() == QtCore.Qt.Key_8:
self.leftPane.click(7)
elif event.key() == QtCore.Qt.Key_9:
self.leftPane.click(8)
# Ctrl + Tab
elif event.key() == QtCore.Qt.Key_Tab:
self.leftPane.clickNext(1)
# Ctrl + BackTab
if (modifiers & QtCore.Qt.ControlModifier) and (modifiers & QtCore.Qt.ShiftModifier):
if event.key() == QtCore.Qt.Key_Backtab:
self.leftPane.clickNext(-1)
# Ctrl + Shift + <key>
if (modifiers & QtCore.Qt.ShiftModifier) and (modifiers & QtCore.Qt.ShiftModifier):
if event.key() == QtCore.Qt.Key_V:
self.current().createSnippet()
return QtGui.QMainWindow.eventFilter(self, obj, event)
def focusInEvent(self, event):
self.launcher.set_property("urgent", False)
self.tray.stopAlert()
def titleChanged(self):
self.setWindowTitle(self.current().title())
def closeEvent(self, event):
if not self.forceClose and self.settings.value("Systray") == "True":
self.hide()
event.ignore()
else:
self.cookiesjar.save()
self.settings.setValue("geometry", self.saveGeometry())
self.settings.setValue("windowState", self.saveState())
# Let's save the first team registered as default
qUrl = self.stackedWidget.widget(0).url()
if self.identifier is None and Resources.MESSAGES_URL_RE.match(qUrl.toString()):
self.settings.setValue("Domain", "https://" + qUrl.host())
def show(self):
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
self.setVisible(True)
def exit(self):
self.forceClose = True
self.close()
def quicklist(self, channels):
if Dbusmenu is not None:
if channels is not None:
ql = Dbusmenu.Menuitem.new()
self.launcher.set_property("quicklist", ql)
for c in channels:
if c["is_member"]:
item = Dbusmenu.Menuitem.new()
item.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "#" + c["name"])
item.property_set("id", c["name"])
item.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
ql.child_append(item)
self.launcher.set_property("quicklist", ql)
def notify(self, title, message, icon=None):
self.notifier.notify(title, message, icon)
self.alert()
def alert(self):
if not self.isActiveWindow():
self.launcher.set_property("urgent", True)
self.tray.alert()
def count(self):
total = 0
for i in range(0, self.stackedWidget.count()):
widget = self.stackedWidget.widget(i)
messages = widget.highlights
if messages == 0:
self.leftPane.stopAlert(widget.team())
else:
self.leftPane.alert(widget.team())
if messages is not None:
total += messages
if total > self.messages:
self.alert()
if 0 == total:
self.launcher.set_property("count_visible", False)
self.tray.setCounter(0)
else:
self.tray.setCounter(total)
self.launcher.set_property("count", total)
self.launcher.set_property("count_visible", True)
self.messages = total