當前位置: 首頁>>代碼示例>>Python>>正文


Python Box.enableRestartButton方法代碼示例

本文整理匯總了Python中Box.Box.enableRestartButton方法的典型用法代碼示例。如果您正苦於以下問題:Python Box.enableRestartButton方法的具體用法?Python Box.enableRestartButton怎麽用?Python Box.enableRestartButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Box.Box的用法示例。


在下文中一共展示了Box.enableRestartButton方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MainWindow

# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import enableRestartButton [as 別名]

#.........這裏部分代碼省略.........
			encode = 'Yes'
		else :
			encode = 'No'
		if ModuleExist.AvahiAvailable and str(self.Settings.value('AvahiDetect', 'True').toString())=='True' :
			self.avahiService = AvahiService(self.menuTab, \
								name = name_, \
								port = self.server_port, \
								description = 'Encoding=' + encode + ';' + \
											  'State=' + str(self.serverState) + ';' + \
											  'Port=' + str(self.server_port) + ';' + \
											  'Address=' + self.server_addr + ';' + \
											  'Name=' + name_.toUtf8().data())
			self.avahiService.start()
		self.initBroadcast(name_, encode)

	def initBroadcast(self, name_ = None, encode = None):
		if name_ is None or encode is None : return None
		if str(self.Settings.value('BroadcastDetect', 'True').toString())=='True' :
			data = QtCore.QString('1' + '<||>' + \
								  name_ + '<||>' + \
								  self.server_addr + '<||>' + \
								  str(self.server_port) + '<||>' + \
								  encode + '<||>' + \
								  self.serverState + '<||>' + \
								  '*infoShare*')
			#Sender(data)
			s = threading.Thread(target = Sender, args = (data,))
			s.start()

	def checkNetwork(self, sharedSourceTree = None, \
						 loadFile = None, previousState = '', \
						 restart = False):
		self.StandBy.stop()
		if self.NetworkState == 1 : self.menuTab.enableRestartButton(False)
		if type(sharedSourceTree) == TreeModel :
			self.restoredInitParameters = (sharedSourceTree, loadFile, previousState, restart)
		checkNetwork = NetworkCheck(self)
		if not self.menuTab.progressBar.isVisible(): self.menuTab.progressBar.show()
		self.statusBar.clearMessage()
		self.statusBar.showMessage('Server offline')
		checkNetwork.start()

	def standByDown(self, address = '', msg = '', netState = 2):
		self.server_addr = str(address)
		self.server_port = getFreePort(int(InitConfigValue(self.Settings, 'MinPort', '34000')), \
										int(InitConfigValue(self.Settings, 'MaxPort', '34100')), \
										self.server_addr)[1]
		print [self.server_addr, ':', self.server_port], 'free'
		if netState > 1 :
			if self.NetworkState == 1 :
				self.NetworkState = 0
				st = str(msg + '\nStandBy?')
				question = QtGui.QMessageBox.question(self, 'Message', st, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
				if question == QtGui.QMessageBox.No : sys.exit(0)
				else :
					## standby mode run
					if 'cachingThread' in dir(self) :
						self.cachingThread._shutdown()
						self.cachingThread.quit()
						del self.cachingThread
					
					self.trayIconPixmap = QtGui.QPixmap('..' + self.SEP + 'icons' + self.SEP + 'LightMight_standBy.png')
					self.trayIcon.setToolTip('LightMight (StandBy)')
					self.trayIcon.setIcon(QtGui.QIcon(self.trayIconPixmap))
					self.menuTab.enableRestartButton(False)
			self.StandBy.start()
開發者ID:F1ash,項目名稱:LightMight,代碼行數:70,代碼來源:__init__.py


注:本文中的Box.Box.enableRestartButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。