def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) 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) image = Gtk.Image.new_from_file(media + "/Graphics/about-screen.png") version_number, os_name = get_current_version() os_variant = read_file_contents('/etc/kanux_version_variant') cpu_id = get_cpu_id() version_align = self.create_align( "Kano OS: {name} v{version}".format(name=os_name, version=version_number), 'about_version') if os_variant: variant_align = self.create_align( "{variant}".format(variant=os_variant), 'about_version') space_align = self.create_align( _("Disk space used: {used}B / {total}B").format( **get_space_available())) try: celsius = u"{:.1f}\N{DEGREE SIGN}C".format(get_temperature()) except ValueError: celsius = "?" temperature_align = self.create_align( _(u"Temperature: {celsius}").format(celsius=celsius)) model_align = self.create_align( _("Model: {model}").format(model=get_model_name())) cpu_id_align = self.create_align(_("CPU ID: {id}").format(id=cpu_id)) terms_and_conditions = OrangeButton(_("Terms and conditions")) terms_and_conditions.connect('button_release_event', self.show_terms_and_conditions) credits_button = OrangeButton(_("Meet the team")) credits_button.connect('button_release_event', self.show_credits) self.kano_button = KanoButton(_("BACK")) self.kano_button.pack_and_align() hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) hbox.pack_start(terms_and_conditions, False, False, 4) hbox.pack_start(credits_button, False, False, 4) hbutton_container = Gtk.Alignment(xalign=0.5, xscale=0, yalign=0, yscale=0) hbutton_container.add(hbox) image.set_margin_top(10) self.pack_start(image, False, False, 10) self.pack_start(version_align, False, False, 2) if os_variant: self.pack_start(variant_align, False, False, 2) self.pack_start(space_align, False, False, 1) self.pack_start(temperature_align, False, False, 1) self.pack_start(model_align, False, False, 1) self.pack_start(cpu_id_align, False, False, 1) self.pack_start(hbutton_container, False, False, 3) self.pack_start(self.kano_button.align, False, False, 10) self.kano_button.connect('button-release-event', self.win.go_to_home) self.kano_button.connect('key-release-event', self.win.go_to_home) # Refresh window self.win.show_all()
def __init__(self, win): # Show the Display brand and model self.model = get_edid_name() info_message = _("\nScreen Model: {}".format(self.model)) # And the current display resolution try: current_resolution = get_status()['resolution'] info_message += _("\nCurrent Resolution: {}").format( _(current_resolution)) except: pass Template.__init__(self, _("Display"), 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') mode_string = '{hdmi_group}:{hdmi_mode} {width}x{height} {refresh_rate}Hz {aspect_ratio}' if modes: for mode in modes: self.mode_combo.append( mode_string.format(hdmi_group=mode['group'], hdmi_mode=mode['mode'], width=mode['width'], height=mode['height'], refresh_rate=mode['rate'], aspect_ratio=mode['aspect_ratio'])) 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 self.flip_preference_start = (get_screen_value('display_rotate') == 2) self.flip_preference_end = self.flip_preference_start flip_button.set_active(self.flip_preference_start) flip_button.connect('clicked', self.on_flip_screen_clicked) 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()