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


Python Entry.set_size_request方法代码示例

本文整理汇总了Python中entry.Entry.set_size_request方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.set_size_request方法的具体用法?Python Entry.set_size_request怎么用?Python Entry.set_size_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entry.Entry的用法示例。


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

示例1: double_click

# 需要导入模块: from entry import Entry [as 别名]
# 或者: from entry.Entry import set_size_request [as 别名]
 def double_click(self, widget, item, column):
     print "DEBUG double_click"
     if not column == item.ENTRY_COLUMN:
         return
     if item.entry:
         item.entry.grab_focus()
         return
     item.entry_buffer.set_property('cursor-visible', True)
     hbox = gtk.HBox(False)
     align = gtk.Alignment(0, 0, 1, 1)
     entry = Entry()
     entry.set_data("item", item)
     entry.set_data("button_press", False)
     entry.set_buffer(item.entry_buffer)
     entry.set_size_request(item.get_column_widths()[column]-4, 0)
     entry.connect("press-return", lambda w: hbox.destroy())
     entry.connect("destroy", self.edit_done, hbox, item)
     entry.connect_after("focus-in-event", self.entry_focus_changed, item)
     entry.connect_after("focus-out-event", self.entry_focus_changed, item)
     self.pack_start(hbox, False, False)
     self.set_data("entry_widget", entry)
     hbox.pack_start(entry, False, False)
     hbox.pack_start(align)
     hbox.show_all()
     entry.set_can_focus(True)
     entry.grab_focus()
     entry.select_all()
     item.entry = entry
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:30,代码来源:entry_treeview.py

示例2: SpinBox

# 需要导入模块: from entry import Entry [as 别名]
# 或者: from entry.Entry import set_size_request [as 别名]

#.........这里部分代码省略.........
        Get upper value.
        '''
        return self.upper_value

    def set_upper(self, value):
        '''
        Set upper with given value.

        @param value: New upper value.
        '''
        self.upper_value = value

    def get_step(self):
        '''
        Get step.
        '''
        return self.step_value

    def set_step(self, value):
        '''
        Set step with given value.

        @param value: New step value.
        '''
        self.set_step = value

    def size_change_cb(self, widget, rect):
        '''
        Internal callback for `size-allocate` signal.
        '''
        if rect.width > self.default_width:
            self.default_width = rect.width

        self.set_size_request(self.default_width, self.default_height)
        self.value_entry.set_size_request(self.default_width - self.arrow_button_width, self.default_height - 2)

    def press_increase_button(self, widget, event):
        '''
        Internal callback when user press increase arrow.
        '''
        # self.stop_update_value()

        self.increase_value()

        # self.increase_value_id = gtk.timeout_add(self.update_delay, self.increase_value)

    def press_decrease_button(self, widget, event):
        '''
        Internal callback when user press decrease arrow.
        '''
        # self.stop_update_value()

        self.decrease_value()

        # self.decrease_value_id = gtk.timeout_add(self.update_delay, self.decrease_value)

    def handle_key_release(self, widget, event):
        '''
        Internal callback for `key-release-event` signal.
        '''
        self.stop_update_value()

        self.emit("key-release", self.current_value)

    def stop_update_value(self):
        '''
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:70,代码来源:spin.py

示例3: SpinBox

# 需要导入模块: from entry import Entry [as 别名]
# 或者: from entry.Entry import set_size_request [as 别名]
class SpinBox(gtk.VBox):
    __gsignals__ = {
        "value-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)),
        "key-release": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)),
    }

    def __init__(self, value=0, lower=0, upper=100, step=10, default_width=55):
        gtk.VBox.__init__(self)
        self.current_value = value
        self.lower_value = lower
        self.upper_value = upper
        self.step_value = step
        self.update_delay = 100  # milliseconds
        self.increase_value_id = None
        self.decrease_value_id = None

        # Init.
        self.default_width = default_width
        self.default_height = 22
        self.arrow_button_width = 19
        self.background_color = ui_theme.get_alpha_color("text_entry_background")
        self.acme_color = ui_theme.get_alpha_color("text_entry_acme")
        self.point_color = ui_theme.get_alpha_color("text_entry_point")
        self.frame_point_color = ui_theme.get_alpha_color("text_entry_frame_point")
        self.frame_color = ui_theme.get_alpha_color("text_entry_frame")

        # Widget.
        arrow_up_button = self.create_simple_button("up", self.press_increase_button)
        arrow_down_button = self.create_simple_button("down", self.press_decrease_button)
        button_box = gtk.VBox()
        button_box.pack_start(arrow_up_button, False, False)
        button_box.pack_start(arrow_down_button, False, False)
        self.value_entry = Entry(str(value))
        self.value_entry.check_text = is_float

        self.main_align = gtk.Alignment()
        self.main_align.set(0.5, 0.5, 0, 0)
        hbox = gtk.HBox()
        hbox.pack_start(self.value_entry, False, False)
        hbox.pack_start(button_box, False, False)
        hbox_align = gtk.Alignment()
        hbox_align.set(0.5, 0.5, 1.0, 1.0)
        hbox_align.set_padding(0, 1, 0, 0)
        hbox_align.add(hbox)
        self.main_align.add(hbox_align)
        self.pack_start(self.main_align, False, False)

        # Signals.
        self.connect("size-allocate", self.size_change_cb)
        self.main_align.connect("expose-event", self.expose_spin_bg)

    def set_sensitive(self, sensitive):
        super(SpinBox, self).set_sensitive(sensitive)
        self.value_entry.set_sensitive(sensitive)

    def get_value(self):
        return self.current_value

    def set_value(self, value):
        new_value = self.adjust_value(value)
        if new_value != self.current_value:
            self.update_and_emit(new_value)

    def value_changed(self):
        self.emit("value-changed", self.current_value)

    def get_lower(self):
        return self.lower_value

    def set_lower(self, value):
        self.lower_value = value

    def get_upper(self):
        return self.upper_value

    def set_upper(self, value):
        self.upper_value = value

    def get_step(self):
        return self.step_value

    def set_step(self, value):
        self.set_step = value

    def size_change_cb(self, widget, rect):
        if rect.width > self.default_width:
            self.default_width = rect.width

        self.set_size_request(self.default_width, self.default_height)
        self.value_entry.set_size_request(self.default_width - self.arrow_button_width, self.default_height - 2)

    def press_increase_button(self, widget, event):
        """Press increase arrow."""
        self.stop_update_value()

        self.increase_value()

        self.increase_value_id = gtk.timeout_add(self.update_delay, self.increase_value)

    def press_decrease_button(self, widget, event):
#.........这里部分代码省略.........
开发者ID:netphi,项目名称:deepin-ui,代码行数:103,代码来源:spin.py


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