def __init__(self, parent, icon, title, subtitle="", icon_position=ICON_RIGHT): unused(subtitle) fsui.Group.__init__(self, parent) self.layout = fsui.HorizontalLayout() image = icon.image(48) self.image_view = fsui.ImageView(self, image) if icon_position == self.ICON_LEFT: self.layout.add(self.image_view) self.layout.add_spacer(20) # vert_layout = fsui.VerticalLayout() # self.layout.add( # vert_layout, expand=True, fill=False, valign=0.5) self.title_label = fsui.HeadingLabel(self, title) if Skin.fws(): font = fsui.Font("Roboto", 26) self.title_label.set_font(font) self.layout.add( self.title_label, expand=True, fill=False, valign=0.0) else: font = self.title_label.get_font() font.increase_size(3) self.title_label.set_font(font) self.layout.add( self.title_label, expand=True, fill=False, valign=0.5) if icon_position == self.ICON_RIGHT: self.layout.add_spacer(20) self.layout.add(self.image_view)
def on_config(self, key, value): unused(value) layout = False if key in ["languages", "protection"]: layout = True if layout: self.layout.update()
def on_setting(self, key, value): unused(value) if key == "config_name": self.x_offset = 0 self.load_images() if key == "parent_uuid": self.x_offset = 0 self.load_images()
def __init__(self, parent, path): unused(path) fsui.Window.__init__(self, parent, gettext("Checksumming")) self.layout = fsui.VerticalLayout() label = fsui.HeadingLabel(self, gettext("Checksumming file...")) self.layout.add(label, fill=True) self.layout.add_spacer(6)
def __init__(self, parent, with_more_button=True): unused(with_more_button) fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() self.model_ids = [ x["id"] for x in Amiga.models if "/" not in x["id"]] self.model_titles = [ x["title"] for x in Amiga.models if "/" not in x["id"]] self.sub_model_ids = [] self.sub_model_titles = [] self.sub_model_updating = False self.model_choice = fsui.Choice(self, self.model_titles) AmigaEnableBehavior(self.model_choice) self.sub_model_choice = fsui.Choice(self, self.sub_model_titles) AmigaEnableBehavior(self.sub_model_choice) self.accuracy_label = fsui.Label(self, gettext("Accuracy:")) self.accuracy_choice = fsui.Choice(self, [ gettext("High"), gettext("Medium"), gettext("Low")]) AmigaEnableBehavior(self.accuracy_choice) self.ntsc_checkbox = ConfigCheckBox(self, "NTSC", "ntsc_mode") AmigaEnableBehavior(self.ntsc_checkbox) # if fs_uae_launcher.ui.get_screen_size()[1] > 768: # self.layout.add(heading_label, margin=10) # self.layout.add_spacer(0) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) heading_label = fsui.HeadingLabel(self, gettext("Amiga Model")) hori_layout.add(heading_label, margin=10) hori_layout.add_spacer(10) hori_layout.add(self.ntsc_checkbox, expand=False, margin_left=10, margin_right=10) hori_layout.add_spacer(0, expand=True) hori_layout.add(self.accuracy_label, margin_right=10) hori_layout.add(self.accuracy_choice, margin_right=10) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) hori_layout.add(self.model_choice, expand=False, margin=10) hori_layout.add(self.sub_model_choice, expand=True, margin=10) ConfigBehavior(self, ["accuracy", "amiga_model"]) self.model_choice.on_changed = self.on_model_changed self.sub_model_choice.on_changed = self.on_sub_model_changed self.accuracy_choice.on_changed = self.on_accuracy_changed
def __init__(self, parent, spacing=10): unused(spacing) fsui.Panel.__init__(self, parent, paintable=True) Skin.set_background_color(self) self.layout = fsui.HorizontalLayout() # self.layout.add_spacer(spacing) # self.layout.padding_left = 10 # self.layout.padding_right = 10 # self.set_background_color((0xdd, 0xdd, 0xdd)) self.set_min_height(Constants.TAB_HEIGHT)
def on_show_license_information(license_text): unused(license_text) # FIXME: don't depend on wx here # noinspection PyUnresolvedReferences # import wx # license_dialog = wx.MessageDialog( # dialog, license_text, _("Terms of Use"), # wx.OK | wx.CANCEL | wx.CENTRE) # license_dialog.CenterOnParent() # result = license_dialog.ShowModal() # return result == wx.ID_OK # FIXME return True
def __init__(self, parent, spacing=10): unused(spacing) Panel.__init__(self, parent, paintable=True) Skin.set_background_color(self) self.layout = HorizontalLayout() self.layout.add_spacer(20) # self.layout.add_spacer(spacing) # self.layout.padding_left = 10 # self.layout.padding_right = 10 # self.set_background_color(Color(0xAEAEAE)) # self.set_min_height(Constants.TAB_HEIGHT) self.bgcolor = get_theme(self).window_bgcolor() self.set_background_color(self.bgcolor)
def __init__(self, parent, paintable=False): unused(paintable) super().__init__(parent) self.set_widget(WidgetWithEventHandlers(QParent(parent), self)) self._widget.move(0, 2000) self._widget.setAutoFillBackground(True) self._parent = weakref.ref(parent) # QWidget.__init__(self, QParent(parent)) # self.init_widget(parent) self.layout = None self._painter = None # QWidget.__init__(self) # self.setParent(parent.get_container()) # super(Panel, self).__init__(parent.get_container()) # super().__init__() self._ignore_next_left_down_event = False
def __init__(self, parent, icon, title, subtitle="", icon_position=ICON_RIGHT): unused(subtitle) fsui.Group.__init__(self, parent) self.layout = fsui.HorizontalLayout() image = icon.image(48) self.image_view = fsui.ImageView(self, image) if icon_position == self.ICON_LEFT: self.layout.add(self.image_view) self.layout.add_spacer(20) # vert_layout = fsui.VerticalLayout() # self.layout.add( # vert_layout, expand=True, fill=False, valign=0.5) self.title_label = fsui.HeadingLabel(self, title) if Skin.fws() or True: font = fsui.Font("Roboto", 26) self.title_label.set_font(font) self.layout.add(self.title_label, expand=True, fill=False, valign=0.0) else: font = self.title_label.get_font() font.increase_size(3) self.title_label.set_font(font) self.layout.add(self.title_label, expand=True, fill=False, valign=0.5) if icon_position == self.ICON_RIGHT: self.layout.add_spacer(20) self.layout.add(self.image_view)
def on_setting(self, key, value): unused(key) unused(value) self.update()
def on_config(self, key, value): if key.startswith("__implicit_"): # The implicit key/values are already set by us. return unused(value) self.update()
def __init__(self, parent, with_more_button=True): unused(with_more_button) fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() self.model_ids = [x["id"] for x in Amiga.models if "/" not in x["id"]] self.model_titles = [ x["title"] for x in Amiga.models if "/" not in x["id"] ] self.sub_model_ids = [] self.sub_model_titles = [] self.sub_model_updating = False self.model_choice = fsui.Choice(self, self.model_titles) # AmigaEnableBehavior(self.model_choice) self.sub_model_choice = fsui.Choice(self, self.sub_model_titles) # AmigaEnableBehavior(self.sub_model_choice) self.accuracy_label = fsui.Label(self, gettext("Accuracy:")) self.accuracy_choice = fsui.Choice( self, [gettext("High"), gettext("Medium"), gettext("Low")] ) # AmigaEnableBehavior(self.accuracy_choice) self.ntsc_checkbox = ConfigCheckBox(self, "NTSC", Option.NTSC_MODE) AmigaShowBehavior(self.accuracy_label) AmigaShowBehavior(self.accuracy_choice) AmigaShowBehavior(self.ntsc_checkbox) # if fs_uae_launcher.ui.get_screen_size()[1] > 768: # self.layout.add(heading_label, margin=10) # self.layout.add_spacer(0) self.model_title_layout = fsui.HorizontalLayout() self.layout.add(self.model_title_layout, fill=True) if openretro or settings.get(Option.PLATFORMS_FEATURE) == "1": heading_label = fsui.HeadingLabel( self, gettext("Platform & Model") ) self.model_title_layout.add(heading_label, margin=10) # platform_group = ConfigWidgetFactory( # check=False, label=False).create(self, Option.PLATFORM) # self.model_title_layout.add(platform_group, margin_left=20) # Adding label to get the vertical spacing correct. # heading_label = fsui.HeadingLabel(self, "") # self.model_title_layout.add(heading_label, margin=10) else: heading_label = fsui.HeadingLabel(self, gettext("Amiga Model")) self.model_title_layout.add(heading_label, margin=10) self.model_title_layout.add_spacer(0, expand=True) self.model_title_layout.add( self.ntsc_checkbox, expand=False, margin_left=10, margin_right=10 ) self.model_title_layout.add_spacer(20) self.model_title_layout.add(self.accuracy_label, margin_right=10) self.model_title_layout.add(self.accuracy_choice, margin_right=10) self.model_title_layout.add(CustomConfigButton(self), margin_right=10) self.model_layout = fsui.HorizontalLayout() def dummy_min_width(): return 0 # Not sure why this is needed, but on startup, the min width # seems to be set too large due to something in the model layout. self.model_layout.get_min_width = dummy_min_width self.layout.add(self.model_layout, fill=True) if openretro or settings.get(Option.PLATFORMS_FEATURE) == "1": platform_group = ConfigWidgetFactory( check=False, label=False ).create(self, Option.PLATFORM) self.model_layout.add(platform_group, margin=10) pass self.other_model_choice = ModelChoice(self) self.model_layout.add(self.other_model_choice, expand=True, margin=10) self.model_layout.add(self.model_choice, expand=False, margin=10) AmigaShowBehavior(self.model_choice) self.model_layout.add(self.sub_model_choice, expand=True, margin=10) AmigaShowBehavior(self.sub_model_choice) ConfigBehavior( self, [Option.ACCURACY, Option.AMIGA_MODEL, Option.PLATFORM] ) self.model_choice.on_changed = self.on_model_changed self.sub_model_choice.on_changed = self.on_sub_model_changed self.accuracy_choice.on_changed = self.on_accuracy_changed
def on_config(self, key, value): unused(value) if key == "amiga_model": self.update_media_type()
def __init__(self, parent, with_more_button=True): unused(with_more_button) fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() self.model_ids = [x["id"] for x in Amiga.models if "/" not in x["id"]] self.model_titles = [ x["title"] for x in Amiga.models if "/" not in x["id"] ] self.sub_model_ids = [] self.sub_model_titles = [] self.sub_model_updating = False self.model_choice = fsui.Choice(self, self.model_titles) # AmigaEnableBehavior(self.model_choice) self.sub_model_choice = fsui.Choice(self, self.sub_model_titles) # AmigaEnableBehavior(self.sub_model_choice) self.accuracy_label = fsui.Label(self, gettext("Accuracy:")) self.accuracy_choice = fsui.Choice( self, [gettext("High"), gettext("Medium"), gettext("Low")]) # AmigaEnableBehavior(self.accuracy_choice) self.ntsc_checkbox = ConfigCheckBox(self, "NTSC", Option.NTSC_MODE) AmigaShowBehavior(self.accuracy_label) AmigaShowBehavior(self.accuracy_choice) AmigaShowBehavior(self.ntsc_checkbox) # if fs_uae_launcher.ui.get_screen_size()[1] > 768: # self.layout.add(heading_label, margin=10) # self.layout.add_spacer(0) self.model_title_layout = fsui.HorizontalLayout() self.layout.add(self.model_title_layout, fill=True) if openretro or settings.get(Option.PLATFORMS_FEATURE) == "1": heading_label = fsui.HeadingLabel(self, gettext("Platform & Model")) self.model_title_layout.add(heading_label, margin=10) # platform_group = ConfigWidgetFactory( # check=False, label=False).create(self, Option.PLATFORM) # self.model_title_layout.add(platform_group, margin_left=20) # Adding label to get the vertical spacing correct. # heading_label = fsui.HeadingLabel(self, "") # self.model_title_layout.add(heading_label, margin=10) else: heading_label = fsui.HeadingLabel(self, gettext("Amiga Model")) self.model_title_layout.add(heading_label, margin=10) self.model_title_layout.add_spacer(0, expand=True) self.model_title_layout.add(self.ntsc_checkbox, expand=False, margin_left=10, margin_right=10) self.model_title_layout.add_spacer(20) self.model_title_layout.add(self.accuracy_label, margin_right=10) self.model_title_layout.add(self.accuracy_choice, margin_right=10) self.model_title_layout.add(CustomConfigButton(self), margin_right=10) self.model_layout = fsui.HorizontalLayout() def dummy_min_width(): return 0 # Not sure why this is needed, but on startup, the min width # seems to be set too large due to something in the model layout. self.model_layout.get_min_width = dummy_min_width self.layout.add(self.model_layout, fill=True) if openretro or settings.get(Option.PLATFORMS_FEATURE) == "1": platform_group = ConfigWidgetFactory(check=False, label=False).create( self, Option.PLATFORM) self.model_layout.add(platform_group, margin=10) pass self.other_model_choice = ModelChoice(self) self.model_layout.add(self.other_model_choice, expand=True, margin=10) self.model_layout.add(self.model_choice, expand=False, margin=10) AmigaShowBehavior(self.model_choice) self.model_layout.add(self.sub_model_choice, expand=True, margin=10) AmigaShowBehavior(self.sub_model_choice) ConfigBehavior(self, [Option.ACCURACY, Option.AMIGA_MODEL, Option.PLATFORM]) self.model_choice.on_changed = self.on_model_changed self.sub_model_choice.on_changed = self.on_sub_model_changed self.accuracy_choice.on_changed = self.on_accuracy_changed
def on_setting(self, key, value): unused(value) if key == Option.DATABASE_AUTH: self.update_title()
def on_select_item(self, index): unused(index) self.remove_button.enable()
def draw_background(cls, widget, dc, selected=False, hover=False, button_style=True): unused(button_style) if selected: cls.draw_selected_tab(widget, dc) else: cls.draw_border(widget, dc) size = widget.size() x = 0 y = 0 w = size[0] h = size[1] - 2 if Skin.fws(): from workspace.ui.theme import Theme theme = Theme.instance() white = fsui.Color(0xff, 0xff, 0xff) if selected: bg_color = theme.window_background bd_color = theme.title_separator_color elif hover: bg_color = theme.window_background.copy().mix( theme.title_background) bd_color = theme.title_separator_color.copy().mix( theme.title_background) else: bg_color = theme.title_background bd_color = theme.title_background # dc.draw_rectangle(0, 0, w, h, bd_color) if selected or hover: dc.draw_vertical_gradient(0, 0, 2, size[1], white, bd_color) dc.draw_vertical_gradient(size[0] - 2, 0, 2, size[1], theme.title_background, bd_color) # dc.draw_rectangle(2, 2, w - 4, h - 2, bg_color) dc.draw_vertical_gradient(2, 0, size[0] - 4, size[1], theme.title_background, bg_color) if hover and not selected: dc.draw_rectangle(0, size[1] - 2, size[0], 2, theme.title_separator_color) else: dc.draw_rectangle(0, 0, w, h, bd_color) return if fsbc.system.macosx: # dc.draw_line(0, 0, w, 0, fsui.Color(198, 198, 198)) # dc.draw_line(0, 0, w, 0, fsui.Color(188, 188, 188)) dc.draw_line(0, 0, w, 0, fsui.Color(248, 248, 248)) y += 1 h -= 1 if selected: x += 2 w -= 4 h += 2 # if button_style and hover: # x += 6 # y += 6 # w -= 12 # h -= 12 color_1 = Skin.get_background_color() if fsbc.system.macosx and False: if selected: color_2 = color_1 color_1 = fsui.Color(0xa7, 0xa7, 0xa7) elif hover: color_1 = fsui.Color(0xa7, 0xa7, 0xa7) color_2 = fsui.Color(0xef, 0xef, 0xef) else: color_1 = fsui.Color(0xa7, 0xa7, 0xa7) color_2 = fsui.Color(0xc0, 0xc0, 0xc0) elif color_1 is not None: if selected: color_2 = color_1 elif hover: color_2 = color_1.copy().lighten() else: color_2 = color_1.copy().darken(0.08) else: if selected: return # color_1 = fsui.Color(0x00, 0x00, 0x00, 0x00) # color_2 = color_1 elif hover: color_1 = fsui.Color(0xff, 0xff, 0xff, 0x00) color_2 = fsui.Color(0xff, 0xff, 0xff, 0x40) else: color_1 = fsui.Color(0x00, 0x00, 0x00, 0x00) color_2 = fsui.Color(0x00, 0x00, 0x00, 0x20) dc.draw_vertical_gradient(x, y, w, h, color_1, color_2) if fsbc.system.macosx and False and not selected and not hover: dc.draw_line(x, y + h - 1, x + w, y + h - 1, fsui.Color(0xa8, 0xa8, 0xa8))
def draw_background( cls, widget, dc, selected=False, hover=False, button_style=True): unused(button_style) if selected: cls.draw_selected_tab(widget, dc) else: cls.draw_border(widget, dc) size = widget.size() x = 0 y = 0 w = size[0] h = size[1] - 2 if Skin.fws(): from workspace.ui.theme import Theme theme = Theme.instance() white = fsui.Color(0xff, 0xff, 0xff) if selected: bg_color = theme.window_background bd_color = theme.title_separator_color elif hover: bg_color = theme.window_background.copy().mix( theme.title_background) bd_color = theme.title_separator_color.copy().mix( theme.title_background) else: bg_color = theme.title_background bd_color = theme.title_background # dc.draw_rectangle(0, 0, w, h, bd_color) if selected or hover: dc.draw_vertical_gradient(0, 0, 2, size[1], white, bd_color) dc.draw_vertical_gradient(size[0] - 2, 0, 2, size[1], theme.title_background, bd_color) # dc.draw_rectangle(2, 2, w - 4, h - 2, bg_color) dc.draw_vertical_gradient(2, 0, size[0] - 4, size[1], theme.title_background, bg_color) if hover and not selected: dc.draw_rectangle(0, size[1] - 2, size[0], 2, theme.title_separator_color) else: dc.draw_rectangle(0, 0, w, h, bd_color) return if fsbc.system.macosx: # dc.draw_line(0, 0, w, 0, fsui.Color(198, 198, 198)) # dc.draw_line(0, 0, w, 0, fsui.Color(188, 188, 188)) dc.draw_line(0, 0, w, 0, fsui.Color(248, 248, 248)) y += 1 h -= 1 if selected: x += 2 w -= 4 h += 2 # if button_style and hover: # x += 6 # y += 6 # w -= 12 # h -= 12 color_1 = Skin.get_background_color() if fsbc.system.macosx and False: if selected: color_2 = color_1 color_1 = fsui.Color(0xa7, 0xa7, 0xa7) elif hover: color_1 = fsui.Color(0xa7, 0xa7, 0xa7) color_2 = fsui.Color(0xef, 0xef, 0xef) else: color_1 = fsui.Color(0xa7, 0xa7, 0xa7) color_2 = fsui.Color(0xc0, 0xc0, 0xc0) elif color_1 is not None: if selected: color_2 = color_1 elif hover: color_2 = color_1.copy().lighten() else: color_2 = color_1.copy().darken(0.08) else: if selected: return # color_1 = fsui.Color(0x00, 0x00, 0x00, 0x00) # color_2 = color_1 elif hover: color_1 = fsui.Color(0xff, 0xff, 0xff, 0x00) color_2 = fsui.Color(0xff, 0xff, 0xff, 0x40) else: color_1 = fsui.Color(0x00, 0x00, 0x00, 0x00) color_2 = fsui.Color(0x00, 0x00, 0x00, 0x20) dc.draw_vertical_gradient(x, y, w, h, color_1, color_2) if fsbc.system.macosx and False and not selected and not hover: dc.draw_line(x, y + h - 1, x + w, y + h - 1, fsui.Color(0xa8, 0xa8, 0xa8))
def on_show_license_information(self, license_text): unused(license_text) print("*** on_show_license_information not implemented ***") raise Exception("on_show_license_information not implemented")
def on_get_item_tooltip(self, row, column): unused(column) return self.items[row][1]
def start_update(cls, version_str): unused(version_str) web_url = "https://fs-uae.net/{0}/download/".format(cls.series()) open_url_in_browser(web_url)
def on_setting(self, key, value): unused(value) if key == "search_path": self.repopulate_list()