当前位置: 首页>>代码示例>>Python>>正文


Python btsyncutils.BtBaseDialog类代码示例

本文整理汇总了Python中btsyncutils.BtBaseDialog的典型用法代码示例。如果您正苦于以下问题:Python BtBaseDialog类的具体用法?Python BtBaseDialog怎么用?Python BtBaseDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BtBaseDialog类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create

	def create(self):
		BtBaseDialog.create(self)
		self.username = self.agent.get_pref('username',None)
		self.password = self.agent.get_pref('password',None)
		self.bindui = self.agent.get_pref('bindui',None)
		self.portui = self.agent.get_pref('portui',None)

		self.username_w = self.builder.get_object('username_value')
		self.password_w = self.builder.get_object('password_value')
		self.bindportset_w = self.builder.get_object('bindport_set')
		self.bindport_w = self.builder.get_object('bindport_value')
		self.bindlocal_w = self.builder.get_object('bind_local')
		self.bindall_w = self.builder.get_object('bind_all')
		self.bindother_w = self.builder.get_object('bind_other')

		self.bindportset_w.set_active(self.portui is not None)
		self.bindport_w.set_sensitive(self.portui is not None)
		self.bindport_w.set_range(8000, 65534)
		self.bindport_w.set_increments(1, 100)
		self.bindport_w.set_value(self.agent.uid + 8999 if self.portui is None else self.portui)
		self.username_w.set_text("" if self.username is None else self.username)
		self.password_w.set_text("" if self.password is None else self.password)

		self.bindother_w.set_sensitive(False)
		if self.bindui is None or self.bindui == '127.0.0.1' or self.bindui == 'localhost':
			self.bindlocal_w.set_active(True)
		elif self.bindui == '0.0.0.0' or self.bindui == 'auto':
			self.bindall_w.set_active(True)
		else:
			self.bindother_w.set_active(True)
		self.changed = False
开发者ID:17Halbe,项目名称:btsync-deb,代码行数:31,代码来源:dialogs.py

示例2: create

	def create(self):
		BtBaseDialog.create(self)
		self.dlg.add_buttons(
			Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
			Gtk.STOCK_OK, Gtk.ResponseType.OK
		)
		self.addr_w = self.builder.get_object('ph_addr')
		self.port_w = self.builder.get_object('ph_port')
开发者ID:Firefishy,项目名称:btsync-deb,代码行数:8,代码来源:dialogs.py

示例3: create

	def create(self,folder,secret):
		BtBaseDialog.create(self)
		# compute secrets
		result = self.api.get_secrets(secret)
		self.idfolder = folder
		self.idsecret = secret
		self.rwsecret = result['read_write'] if result.has_key('read_write') else None
		self.rosecret = result['read_only']
		# initialize OK button
		self.fp_button_ok = self.builder.get_object('fp_button_ok')
		# secrets page
		self.rw_secret = self.builder.get_object('rw_secret')
		self.rw_secret_text = self.builder.get_object('rw_secret_text')
		self.rw_secret_copy = self.builder.get_object('rw_secret_copy')
		self.rw_secret_new  = self.builder.get_object('rw_secret_new')
		self.ro_secret = self.builder.get_object('ro_secret')
		self.ro_secret_text = self.builder.get_object('ro_secret_text')
		self.ro_secret_copy = self.builder.get_object('ro_secret_copy')
		self.ot_secret = self.builder.get_object('ro_secret')
		self.ot_secret_text = self.builder.get_object('ot_secret_text')
		self.ot_secret_copy = self.builder.get_object('ot_secret_copy')
		self.ot_secret_new = self.builder.get_object('ot_secret_new')
		# secrets page - values
		if self.rwsecret is None:
			self.rw_secret.set_sensitive(False)
			self.rw_secret_new.set_sensitive(False)
			self.rw_secret_copy.set_sensitive(False)
		else:
			self.rw_secret_text.set_text(str(self.rwsecret))
		self.ro_secret_text.set_text(str(self.rosecret))
		# prefs page
		self.fp_use_relay = self.builder.get_object('fp_use_relay')
		self.fp_use_tracker = self.builder.get_object('fp_use_tracker')
		self.fp_search_lan = self.builder.get_object('fp_search_lan')
		self.fp_use_dht = self.builder.get_object('fp_use_dht')
		self.fp_use_syncarchive = self.builder.get_object('fp_use_syncarchive')
		self.fp_use_predefined = self.builder.get_object('fp_use_predefined')
		self.fp_predefined_tree = self.builder.get_object('fp_predefined_tree')
		self.fp_predefined_add = self.builder.get_object('fp_predefined_add')
		self.fp_predefined_remove = self.builder.get_object('fp_predefined_remove')
		self.fp_predefined_label = self.builder.get_object('fp_predefined_label')
		# prefs page - values
		result = self.api.get_folder_prefs(self.idsecret)
		self.fp_use_relay.set_active(self.api.get_safe_result(result,'use_relay_server',0) != 0)
		self.fp_use_tracker.set_active(self.api.get_safe_result(result,'use_tracker',0) != 0)
		self.fp_search_lan.set_active(self.api.get_safe_result(result,'search_lan',0) != 0)
		self.fp_use_dht.set_active(self.api.get_safe_result(result,'use_dht',0) != 0)
		self.fp_use_syncarchive.set_active(self.api.get_safe_result(result,'use_sync_trash',0) != 0)
		self.fp_use_predefined.set_active(self.api.get_safe_result(result,'use_hosts',0) != 0)
		self.fp_use_predefined.set_sensitive(False)
		self.fp_predefined_tree.set_sensitive(False)
		self.fp_predefined_add.set_sensitive(False)
		self.fp_predefined_remove.set_sensitive(False)
		self.fp_predefined_label.set_sensitive(False)
		# nothing is changed now
		self.fp_button_ok.set_sensitive(False)
开发者ID:brianpburns,项目名称:btsync-deb,代码行数:56,代码来源:dialogs.py

示例4: __init__

	def __init__(self,api):
		BtBaseDialog.__init__(self,
			'dialogs.glade',
			'folderprefs', [
				'rw_secret_text',
				'ro_secret_text',
				'ot_secret_text'
			]
		)
		self.api = api
		self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
开发者ID:brianpburns,项目名称:btsync-deb,代码行数:11,代码来源:dialogs.py

示例5: __init__

	def __init__(self,agent):
		BtBaseDialog.__init__(self,
			'dialogs.glade',
			'prefsadvanced', [
				'advancedprefs'
			]
		)
		BtInputHelper.__init__(self)
		self.agent = agent
		self.prefs = self.agent.get_prefs()
		self.create()
开发者ID:Firefishy,项目名称:btsync-deb,代码行数:11,代码来源:dialogs.py

示例6: create

	def create(self):
		BtBaseDialog.create(self)
		# get the editing widgets
		self.advancedprefs = self.builder.get_object('advancedprefs')
		self.ap_tree_prefs = self.builder.get_object('ap_tree_prefs')
		self.ap_label_value = self.builder.get_object('ap_label_value')
		self.ap_switch_value = self.builder.get_object('ap_switch_value')
		self.ap_entry_value = self.builder.get_object('ap_entry_value')
		self.ap_reset_value = self.builder.get_object('ap_reset_value')
		self.set_treeview_sort_info(
			self.ap_tree_prefs,
			[0, Gtk.SortType.ASCENDING]
		)
		# initialize content
		self.init_editor()
		self.init_values()
开发者ID:ywrac,项目名称:btsync-deb,代码行数:16,代码来源:dialogs.py

示例7: run

	def run(self):
		while True:
			response = BtBaseDialog.run(self)
			if response == Gtk.ResponseType.CANCEL:
				return response
			elif response == Gtk.ResponseType.OK:
				self.secret = self.secret_w.get_text()
				self.folder = self.folder_w.get_text()
				# test if secret is OK
				if self.api.get_error_code(self.api.get_secrets(self.secret)) > 0:
					self.show_warning(
						'This secret is invalid.\nPlease generate a new '\
						'secret or enter your shared folder secret.'
					)
				# test if string is an absolute path and a directory
				elif len(self.folder) == 0 or self.folder[0] != '/' or not os.path.isdir(self.folder):
					self.show_warning('Can\'t open the destination folder.')
				# test if the specified directory is readable and writable
				elif not os.access(self.folder,os.W_OK) or not os.access(self.folder,os.R_OK):
					self.show_warning(
						'Don\'t have permissions to write to the selected folder.'
					)
				# test if the specified data is unique
				elif self.is_duplicate_folder(self.folder,self.secret):
					self.show_warning('Selected folder is already added to BitTorrent Sync.')
				else:
					return response
开发者ID:brianpburns,项目名称:btsync-deb,代码行数:27,代码来源:dialogs.py

示例8: run

	def run(self):
		self.dlg.set_default_response(Gtk.ResponseType.OK)
		while True:
			response = BtBaseDialog.run(self)
			if response == Gtk.ResponseType.CANCEL:
				return response
			elif response == Gtk.ResponseType.DELETE_EVENT:
				return response
			elif response == Gtk.ResponseType.OK:
				if self.changed:
					# read settings
					self.username = self.username_w.get_text()
					self.password = self.password_w.get_text()
					if self.username == '' or self.password == '':
						self.username = None
						self.password = None
					self.portui = self.bindport_w.get_value_as_int() if self.bindportset_w.get_active() else None
					if self.bindlocal_w.get_active():
						self.bindui = None
					elif self.bindall_w.get_active():
						self.bindui = '0.0.0.0'
					# process settings
					self.agent.set_pref('username', self.username, delnone=True)
					self.agent.set_pref('password', self.password, delnone=True)
					self.agent.set_pref('bindui', self.bindui, delnone=True)
					self.agent.set_pref('portui', self.portui, delnone=True)
					# restart the whole game...
					if self.agent.paused:
						self.agent.load_prefs()
						self.agent.read_prefs()
						self.agent.reset_connection_params()
					else:
						self.agent.suspend()
						self.agent.load_prefs()
						self.agent.read_prefs()
						self.agent.reset_connection_params()
						self.agent.resume()
				return response
开发者ID:17Halbe,项目名称:btsync-deb,代码行数:38,代码来源:dialogs.py

示例9: run

	def run(self):
		self.dlg.set_default_response(Gtk.ResponseType.OK)
		while True:
			response = BtBaseDialog.run(self)
			if response == Gtk.ResponseType.CANCEL:
				return response
			elif response == Gtk.ResponseType.DELETE_EVENT:
				return response
			elif response == Gtk.ResponseType.OK:
				self.addr = self.addr_w.get_text()
				self.port = self.port_w.get_text()
				# test if a hostname is specified
				if len(self.addr) == 0:
					self.show_warning(_(
						'A hostname or IP address must be specified'
					))
				# test if port is OK
				elif len(self.port) == 0 or int(self.port) < 1 or int(self.port) > 65534:
					self.show_warning(_(
						'The specified port must be a number between 1 and 65534'
					))
				else:
					return response
开发者ID:Firefishy,项目名称:btsync-deb,代码行数:23,代码来源:dialogs.py

示例10: response

	def response(self,result_id):
		if self.folderdlg is not None:
			self.folderdlg.response(result_id)
		BtBaseDialog.response(self,result_id)
开发者ID:Firefishy,项目名称:btsync-deb,代码行数:4,代码来源:dialogs.py

示例11: __init__

	def __init__(self,agent):
		BtBaseDialog.__init__(self, 'dialogs.glade', 'advsettings')
		self.agent = agent
		self.changed = False
开发者ID:17Halbe,项目名称:btsync-deb,代码行数:4,代码来源:dialogs.py


注:本文中的btsyncutils.BtBaseDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。