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


Python OrangeButton.set_image方法代码示例

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


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

示例1: OverscanTemplate

# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import set_image [as 别名]
class OverscanTemplate(Gtk.Box):
    def __init__(self, win, title, description, original_overscan=None):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.kano_button = KanoButton("APPLY CHANGES")
        self.kano_button.connect("button-release-event", self.apply_changes)
        self.kano_button.pack_and_align()

        self.heading = Heading(title, description)
        self.pack_start(self.heading.container, False, False, 0)

        self.win = win
        self.win.set_main_widget(self)

        self.win.top_bar.enable_prev()

        # Launch pipe for the overscan c code
        launch_pipe()

        self.overscan_values = get_overscan_status()
        self.original_overscan = original_overscan

        # Pass original overscan values between the classes
        # If original_overscan hasn't been generated yet, get it from current overscan status
        # Alternatively, maybe read this from a file in future
        if original_overscan is None:
            self.original_overscan = get_overscan_status()

        # Reset button
        self.reset_button = OrangeButton()
        reset_image = Gtk.Image().new_from_file(common.media + "/Icons/reset.png")
        self.reset_button.set_image(reset_image)
        self.reset_button.connect("button_press_event", self.reset)

    def apply_changes(self, button, event):
        # Apply changes
        write_overscan_values(self.overscan_values)
        self.original_overscan = self.overscan_values
        set_config_comment('kano_screen_used', get_model())

        # Tell user to reboot to see changes
        common.need_reboot = True

        self.go_to_display()

    def adjust(self, adj, varname):
        self.overscan_values[varname] = int(adj.get_value())
        set_overscan_status(self.overscan_values)

    def adjust_all(self, adj):
        self.overscan_values['top'] = int(adj.get_value())
        self.overscan_values['bottom'] = int(adj.get_value())
        self.overscan_values['left'] = int(adj.get_value())
        self.overscan_values['right'] = int(adj.get_value())
        set_overscan_status(self.overscan_values)

    def go_to_display(self, widget=None, button=None):
        self.reset()
        self.win.clear_win()
        SetDisplay(self.win)

    def reset(self, widget=None, event=None):
        pass
开发者ID:gvsurenderreddy,项目名称:kano-settings,代码行数:65,代码来源:set_display.py


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