本文整理汇总了Python中kiwi.ui.widgets.entry.ProxyEntry.set_sensitive方法的典型用法代码示例。如果您正苦于以下问题:Python ProxyEntry.set_sensitive方法的具体用法?Python ProxyEntry.set_sensitive怎么用?Python ProxyEntry.set_sensitive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.ui.widgets.entry.ProxyEntry
的用法示例。
在下文中一共展示了ProxyEntry.set_sensitive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_attach
# 需要导入模块: from kiwi.ui.widgets.entry import ProxyEntry [as 别名]
# 或者: from kiwi.ui.widgets.entry.ProxyEntry import set_sensitive [as 别名]
def test_attach(self):
entry = ProxyEntry()
entry.data_type = currency
self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None)
calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB)
pixbuf_pixels = calc.render_icon(STOQ_CALC,
gtk.ICON_SIZE_MENU).get_pixels()
self.assertEqual(
entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
entry.set_sensitive(False)
self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None)
entry.set_sensitive(True)
self.assertEqual(
entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
spinbutton = ProxySpinButton()
spinbutton.data_type = currency
self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None)
calc = CalculatorPopup(spinbutton, CalculatorPopup.MODE_SUB)
pixbuf_pixels = calc.render_icon(STOQ_CALC,
gtk.ICON_SIZE_MENU).get_pixels()
self.assertEqual(
spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
spinbutton.set_sensitive(False)
self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None)
spinbutton.set_sensitive(True)
self.assertEqual(
spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
示例2: AccountEditor
# 需要导入模块: from kiwi.ui.widgets.entry import ProxyEntry [as 别名]
# 或者: from kiwi.ui.widgets.entry.ProxyEntry import set_sensitive [as 别名]
class AccountEditor(BaseEditor):
""" Account Editor """
gladefile = "AccountEditor"
proxy_widgets = ['description', 'code']
model_type = Account
model_name = _('Account')
def __init__(self, store, model=None, parent_account=None):
self._last_account_type = None
self._bank_number = -1
self._bank_widgets = []
self._bank_option_widgets = []
self._option_fields = {}
self._test_button = None
self.existing = model is not None
self.parent_account = parent_account
self.bank_model = _TemporaryBankAccount()
BaseEditor.__init__(self, store, model)
action_area = self.main_dialog.action_area
action_area.set_layout(gtk.BUTTONBOX_END)
action_area.pack_start(self._test_button, expand=False, fill=False)
action_area.set_child_secondary(self._test_button, True)
self._test_button.show()
#
# BaseEditor hooks
#
def create_model(self, store):
return Account(description=u"",
account_type=Account.TYPE_CASH,
store=store)
def _setup_widgets(self):
self._test_button = gtk.Button(_("Print a test bill"))
self._test_button.connect('clicked',
self._on_test_button__clicked)
self.parent_accounts = AccountTree(with_code=False, create_mode=True)
self.parent_accounts.connect('selection-changed',
self._on_parent_accounts__selection_changed)
self.tree_box.pack_start(self.parent_accounts)
self.tree_box.reorder_child(self.parent_accounts, 0)
if self.model == sysparam(self.store).IMBALANCE_ACCOUNT:
self.account_type.set_sensitive(False)
self.account_type.prefill(Account.account_type_descriptions)
account_type = self.model.account_type
self.parent_accounts.insert_initial(self.store,
edited_account=self.model)
if self.parent_account:
account = self.parent_accounts.get_account_by_id(
self.parent_account.id)
self.parent_accounts.select(account)
if not self.existing:
account_type = account.account_type
self.account_type.select(account_type)
self.parent_accounts.show()
def setup_proxies(self):
self._setup_widgets()
self.add_proxy(self.model, AccountEditor.proxy_widgets)
def validate_confirm(self):
if not self.model.description:
return False
account = self.parent_accounts.get_selected()
if not account:
return True
return account.selectable
def on_confirm(self):
new_parent = self.parent_accounts.get_selected()
if new_parent:
new_parent = new_parent.account
if new_parent != self.model:
self.model.parent = new_parent
self.model.account_type = self.account_type.get_selected()
self._save_bank()
def refresh_ok(self, value):
BaseEditor.refresh_ok(self, value)
account_type = self.account_type.get_selected()
if account_type != Account.TYPE_BANK:
value = False
self._test_button.set_sensitive(value)
# Private
def _save_bank(self):
bank_account = self.model.bank
if not bank_account:
bank_account = BankAccount(account=self.model,
store=self.store)
# FIXME: Who sets this to a str?
bank_account.bank_account = unicode(self.bank_model.bank_account)
bank_account.bank_branch = unicode(self.bank_model.bank_branch)
#.........这里部分代码省略.........