本文整理汇总了Python中connector.Connector.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.stop方法的具体用法?Python Connector.stop怎么用?Python Connector.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import stop [as 别名]
class MainWindow(QtGui.QWidget):
forceSig = QtCore.Signal(bool)
def __init__(self):
QtGui.QWidget.__init__(self)
self.setObjectName("MainWindow")
self.icon = QtGui.QIcon('icon.png')
self.host_lb = QtGui.QLabel()
self.win1_data_lb = QtGui.QLabel()
self.win4_data_lb = QtGui.QLabel()
self.win1_data_lb.setAlignment(QtCore.Qt.AlignRight)
self.win4_data_lb.setAlignment(QtCore.Qt.AlignRight)
self.status_lb = QtGui.QLabel(u"Sztátus:")
self.createTrayIcon()
self.conn = Connector(self.forceSig)
self.conn.refreshed.connect(self.update)
self.conn.statusSig.connect(self.setStatus)
self.conn.uconnected.connect(self.connectError)
self.conn.start()
layout = QtGui.QVBoxLayout()
btn_lyl = QtGui.QHBoxLayout()
box = QtGui.QGroupBox()
box.setTitle("Adatok")
box.setLayout(self.createNWDataLayout())
setting_bt = QtGui.QPushButton()
setting_bt.setText(u"Beállítások")
setting_bt.clicked.connect(self.settings)
self.forcing_bt = QtGui.QPushButton()
self.forcing_bt.setText(u"Megállít")
self.forcing_bt.clicked.connect(self.forcing)
btn_lyl.addSpacerItem(QtGui.QSpacerItem(0,0))
btn_lyl.addWidget(setting_bt)
btn_lyl.addWidget(self.forcing_bt)
layout.addWidget(box)
layout.addLayout(btn_lyl)
self.setLayout(layout)
self.setMinimumWidth(300)
self.setWindowFlags(QtCore.Qt.Tool)
self.setWindowTitle("Bitwatcher v0.10 BETA")
def setStatus(self, status):
self.status = status
if self.status == 0:
self.forcing_bt.setText(u"Erőltetett indítás")
self.status_lb.setText(u"Szüneteltetve")
elif self.status == 1:
self.forcing_bt.setText(u"Erőltetett szüneteltetés")
self.status_lb.setText(u"Seedel")
elif self.status == 2:
self.forcing_bt.setText(u"Erőltetés vége")
self.status_lb.setText(u"Erőltetett szünet")
elif self.status == 3:
self.forcing_bt.setText(u"Erőltetés vége")
self.status_lb.setText(u"Erőltetett seed")
def forcing(self):
if self.status == 0 or self.status == 1:
self.forceSig.emit(True)
elif self.status == 2 or self.status == 3:
self.forceSig.emit(False)
def connectError(self, conn):
if not conn:
self.tray.showMessage("Kapcsolat hiba", u"A Bitwatcher nem tud csatlakozni a uTorrenthez. Ellenőrizd a beállításokat!")
def createNWDataLayout(self):
lyl = QtGui.QGridLayout()
win1_text_lb = QtGui.QLabel(u"Egy napos forgalom:")
win4_text_lb = QtGui.QLabel(u"Négy napos frogalom:")
lyl.addWidget(self.host_lb,0,0)
lyl.addWidget(win1_text_lb,1,0)
lyl.addWidget(win4_text_lb,2,0)
lyl.addWidget(self.win1_data_lb,1,1)
lyl.addWidget(self.win4_data_lb,2,1)
lyl.addWidget(self.status_lb,3,0)
return lyl
def quit(self):
self.conn.stop()
QtGui.qApp.quit()
def trayActivated(self, reason):
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
self.show()
self.activateWindow()
def createTrayIcon(self):
self.trayIconMenu = QtGui.QMenu(self)
self.trayIconMenu.addSeparator()
quit = QtGui.QAction(u"&Kilép", self)
forcing = QtGui.QAction(u"&Erőltet", self)
forcing.triggered.connect(self.forcing)
quit.triggered.connect(self.quit)
sett = QtGui.QAction(u"&Beállít", self)
sett.triggered.connect(self.settings)
self.trayIconMenu.addAction(sett)
#.........这里部分代码省略.........