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()
Beispiel #2
0
    def apply_changes(self, button, event):
        # Apply changes
        set_config_comment('kano_screen_used', get_model())
        # NB, write_overscan_values ends the transaction
        write_overscan_values(self.overscan_values)
        self.original_overscan = self.overscan_values

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

        self.go_to_display()
    def __init__(self, win):
        # Show the Display brand and model
        self.model = get_model()
        info_message = ' (Changing this requires a reboot)'

        # And the current display resolution
        try:
            current_resolution = get_status()['resolution']
            info_message += '\n\nCurrent resolution: {}'.format(current_resolution)
        except:
            pass

        Template.__init__(
            self,
            "Display",
            self.model + info_message,
            "APPLY CHANGES"
        )

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

        self.win.top_bar.enable_prev()
        self.win.change_prev_callback(self.win.go_to_home)

        self.kano_button.connect("button-release-event", self.apply_changes)
        self.kano_button.connect("key-release-event", self.apply_changes)

        horizontal_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=40)
        horizontal_container.set_valign(Gtk.Align.CENTER)

        # HDMI mode combo box
        self.mode_combo = KanoComboBox(max_display_items=7)
        self.mode_combo.connect("changed", self.on_mode_changed)

        # Fill list of modes
        modes = list_supported_modes()
        self.mode_combo.append("auto")
        if modes:
            for v in modes:
                self.mode_combo.append(v)

        horizontal_container.pack_start(self.mode_combo, False, False, 0)
        self.mode_combo.props.valign = Gtk.Align.CENTER

        # Select the current setting in the dropdown list
        saved_group, saved_mode = read_hdmi_mode()
        active_item = find_matching_mode(modes, saved_group, saved_mode)
        self.mode_combo.set_selected_item_index(active_item)
        self.init_item = active_item
        self.mode_index = active_item
        # Overscan button
        overscan_button = OrangeButton("Overscan")
        horizontal_container.pack_end(overscan_button, False, False, 0)
        overscan_button.connect("button-release-event", self.go_to_overscan)

        self.box.pack_start(horizontal_container, False, False, 0)

        # Create Flip 180 checkbox 
        flip_button = Gtk.CheckButton("Flip Screen")
        flip_button.set_can_focus(False)
        flip_button.props.valign = Gtk.Align.CENTER
        flip_button.set_active(get_config_value("display_rotate") == 2)
        flip_button.connect("clicked", self.flip)

        self.box.pack_start(flip_button, False, False, 0)
        self.kano_button.set_sensitive(False)

        # Add apply changes button under the main settings content
        self.win.show_all()
Beispiel #4
0
    def __init__(self, win):
        # Show the Display brand and model
        self.model = get_model()
        info_message = _(" (Changing this requires a reboot)")

        # And the current display resolution
        try:
            current_resolution = get_status()['resolution']
            info_message += _("\n\nCurrent resolution: {}").format(_(current_resolution))
        except:
            pass

        Template.__init__(
            self,
            _("Display"),
            self.model + info_message,
            _("APPLY CHANGES")
        )

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

        self.win.top_bar.enable_prev()
        self.win.change_prev_callback(self.win.go_to_home)

        self.kano_button.connect('button-release-event', self.apply_changes)
        self.kano_button.connect('key-release-event', self.apply_changes)

        horizontal_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
                                       spacing=40)
        horizontal_container.set_valign(Gtk.Align.CENTER)

        # HDMI mode combo box
        self.mode_combo = KanoComboBox(max_display_items=7)
        self.mode_combo.connect('changed', self.on_mode_changed)

        # Fill list of modes
        modes = list_supported_modes()
        self.mode_combo.append('auto')
        if modes:
            for v in modes:
                self.mode_combo.append(v)

        horizontal_container.pack_start(self.mode_combo, False, False, 0)
        self.mode_combo.props.valign = Gtk.Align.CENTER

        # Select the current setting in the dropdown list
        saved_group, saved_mode = read_hdmi_mode()
        active_item = find_matching_mode(modes, saved_group, saved_mode)
        self.mode_combo.set_selected_item_index(active_item)
        self.init_item = active_item
        self.mode_index = active_item
        # Overscan button
        overscan_button = OrangeButton(_("Overscan"))
        horizontal_container.pack_end(overscan_button, False, False, 0)
        overscan_button.connect('button-release-event', self.go_to_overscan)

        self.box.pack_start(horizontal_container, False, False, 0)

        # Create Flip 180 checkbox
        flip_button = Gtk.CheckButton(_("Flip Screen"))
        flip_button.set_can_focus(False)
        flip_button.props.valign = Gtk.Align.CENTER
        flip_button.set_active(get_screen_value('display_rotate') == 2)
        flip_button.connect('clicked', self.flip)

        self.box.pack_start(flip_button, False, False, 0)
        self.kano_button.set_sensitive(False)

        # Add apply changes button under the main settings content
        self.win.show_all()