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


Python entry.ProxyEntry类代码示例

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


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

示例1: test_attach

    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)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:30,代码来源:test_calculator.py

示例2: __init__

 def __init__(self):
     entry = ProxyEntry()
     ComboEntry.__init__(self, entry=entry)
     ValidatableProxyWidgetMixin.__init__(self)
     entry.connect('content-changed', self._on_entry__content_changed)
     entry.connect('validation-changed',
                   self._on_entry__validation_changed)
开发者ID:hackedbellini,项目名称:kiwi,代码行数:7,代码来源:combo.py

示例3: testDigitMask

 def testDigitMask(self):
     e = ProxyEntry()
     e.set_mask('000.000')
     self.assertEqual(e.get_text(), '   .   ')
     e.set_text('123.456')
     self.assertEqual(e.get_text(), '123.456')
     e.delete_text(0, 2)
     self.assertEqual(e.get_text(), '345.6  ')
开发者ID:hackedbellini,项目名称:kiwi,代码行数:8,代码来源:test_Entry.py

示例4: testRead

 def testRead(self):
     entry = ProxyEntry()
     entry.set_text('1')
     entry.set_property("data-type", "int")
     self.assertEqual(entry.read(), 1)
     entry.set_text('')
     self.assertEqual(entry.read(), ValueUnset)
开发者ID:gxela,项目名称:kiwi-gtk,代码行数:7,代码来源:test_Entry.py

示例5: testMaskSmallFields

 def testMaskSmallFields(self):
     e = ProxyEntry()
     e.set_mask('0.0.0')
     self.assertEqual(e.get_text(), ' . . ')
     self.assertEqual(e.get_fields(), ['', '', ''])
     e.set_text('1.2.3')
     self.assertEqual(e.get_text(), '1.2.3')
     self.assertEqual(e.get_fields(), ['1', '2', '3'])
开发者ID:gxela,项目名称:kiwi-gtk,代码行数:8,代码来源:test_Entry.py

示例6: testAlphaNumericMask

 def testAlphaNumericMask(self):
     e = ProxyEntry()
     e.set_mask('&&&-aaa')
     self.assertEqual(e.get_text(), '   -   ')
     self.assertEqual(e.get_fields(), ['', ''])
     e.set_text('aáé-á1e')
     self.assertEqual(e.get_text(), 'aáé-á1e')
     self.assertEqual(e.get_fields(), ['aáé', 'á1e'])
开发者ID:gxela,项目名称:kiwi-gtk,代码行数:8,代码来源:test_Entry.py

示例7: testAsciiMask

 def testAsciiMask(self):
     e = ProxyEntry()
     e.set_mask('LLLL-L')
     self.assertEqual(e.get_text(), '    - ')
     self.assertEqual(e.get_fields(), ['', ''])
     e.set_text('abcd-e')
     self.assertEqual(e.get_text(), 'abcd-e')
     self.assertEqual(e.get_fields(), ['abcd', 'e'])
开发者ID:gxela,项目名称:kiwi-gtk,代码行数:8,代码来源:test_Entry.py

示例8: test_apply

    def test_apply(self):
        entry = ProxyEntry()
        entry.data_type = currency
        entry.set_text('150')
        calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB)

        # calc.popup will not work here, so call _update_ui directly
        calc._update_ui()
        calc._entry.set_text('10%')
        event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
        event.keyval = gtk.keysyms.Return
        event.window = gtk.gdk.get_default_root_window()
        calc.emit('key-press-event', event)
        calc.emit('key-press-event', event)
        self.assertEqual(entry.read(), 135)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:15,代码来源:test_calculator.py

示例9: __init__

    def __init__(self):
        gtk.HBox.__init__(self)

        self._popping_down = False
        self._old_date = None

        # bootstrap problems, kiwi.ui.widgets.entry imports dateentry
        # we need to use a proxy entry because we want the mask
        from kiwi.ui.widgets.entry import ProxyEntry
        self.entry = ProxyEntry()
        self.entry.connect('changed', self._on_entry__changed)
        self.entry.connect('activate', self._on_entry__activate)
        self.entry.set_property('data-type', datetime.date)
        mask = self.entry.get_mask()
        if mask:
            self.entry.set_width_chars(len(mask))
        self.pack_start(self.entry, False, False)
        self.entry.show()

        self._button = gtk.ToggleButton()
        self._button.connect('scroll-event', self._on_entry__scroll_event)
        self._button.connect('toggled', self._on_button__toggled)
        self._button.set_focus_on_click(False)
        self.pack_start(self._button, False, False)
        self._button.show()

        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
        self._button.add(arrow)
        arrow.show()

        self._popup = _DateEntryPopup(self)
        self._popup.connect('date-selected', self._on_popup__date_selected)
        self._popup.connect('hide', self._on_popup__hide)
        self._popup.set_size_request(-1, 24)
开发者ID:Schevo,项目名称:kiwi,代码行数:34,代码来源:dateentry.py

示例10: test_popdown

    def test_popdown(self):
        entry = ProxyEntry()
        entry.data_type = currency
        entry.set_text('150')
        calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB)

        with contextlib.nested(
                mock.patch.object(calc, '_maybe_apply_new_value'),
                mock.patch.object(calc, 'popdown')) as (manv, popdown):
            # Those keys should try to apply the value
            for keyval in [gtk.keysyms.Return,
                           gtk.keysyms.KP_Enter,
                           gtk.keysyms.Tab]:
                event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
                event.keyval = keyval
                event.window = gtk.gdk.get_default_root_window()
                calc.emit('key-press-event', event)

                self.assertEqual(manv.call_count, 1)
                self.assertEqual(popdown.call_count, 0)

                manv.reset_mock()
                popdown.reset_mock()

            event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
            # Escape should popdown the popup
            event.keyval = gtk.keysyms.Escape
            event.window = gtk.gdk.get_default_root_window()
            calc.emit('key-press-event', event)

            self.assertEqual(popdown.call_count, 1)
            self.assertEqual(manv.call_count, 0)
            manv.reset_mock()
            popdown.reset_mock()

            event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
            # Any other should not do anything
            event.keyval = gtk.keysyms.A
            event.window = gtk.gdk.get_default_root_window()
            calc.emit('key-press-event', event)

            self.assertEqual(manv.call_count, 0)
            self.assertEqual(popdown.call_count, 0)
开发者ID:Guillon88,项目名称:stoq,代码行数:43,代码来源:test_calculator.py

示例11: _create_interface

    def _create_interface(self):
        self.sale = self.create_sale()

        self.window = gtk.Window()
        self.entry = ProxyEntry()
        self.window.add(self.entry)
        self.client_gadget = SearchEntryGadget(
            self.entry, self.store, model=self.sale, model_property='client',
            search_columns=['name'], search_class=ClientSearch,
            parent=self.window)
开发者ID:Joaldino,项目名称:stoq,代码行数:10,代码来源:test_searchentry.py

示例12: _setup_entry_slave

    def _setup_entry_slave(self, box=None):
        widget = ProxyEntry()
        widget.props.sensitive = self.sensitive
        widget.data_type = unicode
        widget.model_attribute = "field_value"
        self.proxy.add_widget("field_value", widget)
        if box is None:
            self.container.add(widget)
        else:
            box.pack_start(widget)

        widget.show()
        widget.connect("validate", self._on_entry__validate)
        widget.connect("validation-changed", self._on_entry__validation_changed)

        self._entry = widget
开发者ID:coletivoEITA,项目名称:stoq,代码行数:16,代码来源:parameterseditor.py

示例13: _create_interface

    def _create_interface(self, run_editor=None):
        self.sale = self.create_sale()

        self.window = gtk.Window()
        self.entry = ProxyEntry()
        self.window.add(self.entry)
        self.client_gadget = SearchEntryGadget(
            self.entry, self.store, model=self.sale, model_property='client',
            search_columns=['name'], search_class=ClientSearch,
            parent=self.window, run_editor=run_editor)
        self.client_gadget.get_model_obj = lambda obj: obj and obj.client
开发者ID:Guillon88,项目名称:stoq,代码行数:11,代码来源:test_searchentry.py

示例14: build_widget

    def build_widget(self):
        if self.editable:
            widget = ProxyEntry()
            if self.max_length != 0:
                widget.set_width_chars(self.max_length)
            if self.input_mask:
                widget.set_mask(self.input_mask)
        else:
            widget = ProxyLabel()
            # This label should be left aligned.
            widget.set_alignment(0, 0.5)

        return widget
开发者ID:hackedbellini,项目名称:kiwi,代码行数:13,代码来源:forms.py

示例15: test_popup

    def test_popup(self):
        entry = ProxyEntry()
        entry.data_type = currency
        entry.set_text('150')
        calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB)

        event = gtk.gdk.Event(gtk.gdk.BUTTON_PRESS)
        event.window = gtk.gdk.get_default_root_window()

        with mock.patch.object(calc, 'popup') as popup:
            entry.emit('icon-press', gtk.ENTRY_ICON_PRIMARY, event)
            self.assertEqual(popup.call_count, 0)
            entry.emit('icon-press', gtk.ENTRY_ICON_SECONDARY, event)
            popup.assert_called_once()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:14,代码来源:test_calculator.py


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