def on_paint(self): size = self.size() dc = self.create_dc() selected = self.state == self.STATE_SELECTED if selected: backgroundcolor = Color(Launcher2Colors.CONFIG_PANEL_COLOR) elif self.hover: backgroundcolor = Color(0xB2B2B2) else: backgroundcolor = self.bgcolor dc.draw_rectangle(0, 0, size[0], size[1], backgroundcolor) # TabPanel.draw_background( # self, # dc, # selected=selected, # hover=self.hover, # button_style=(self.type == self.TYPE_BUTTON), # ) # TabPanel.draw_border(self, dc) x = (self.left_padding + (size[0] - self.left_padding - self.right_padding - self.icon.size[0]) // 2) # subtracting two because of bottom border y = (size[1] - 2 - self.icon.size[1]) // 2 dc.draw_image(self.icon, x, y)
def __init__(self, parent, option): super().__init__(parent) self.option = option self.set_min_size((40, 30)) # FIXME: Filter on options? # get_settings(self).add_listener(self, [self.option]) self.color = Color(0, 0, 0) self.bordercolor = Color(0x666666) # self.cornercolor = Color(0xff0000) self.on_setting(self.option, get_settings(self).get(self.option)) get_settings(self).add_listener(self)
def update_background_color(self): if self._pressed and self._hovering: # FIXME: Get from theme? c = Color(0, 0, 0, 0x33) elif self._hovering: # FIXME: Get from theme? c = Color(0xFF, 0xFF, 0xFF, 0x33) else: c = None self.set_background_color(c) self.refresh_maybe()
def _update_color(self, name, value): # if name == "window_bgcolor" # print("_") color = None if value and value != "#00000000": try: color = Color.from_hex(value) except Exception: pass if color is None: color = Color.from_hex(getattr(self, f"_{name}_default_str")) print("Setting", name, "->", color) setattr(self, f"_{name}", color)
def on_paint(self): dc = self.create_dc() size = self.size() if Skin.fws(): dc.draw_rectangle(0, 0, size[0], 2, Color(0xe5, 0xe5, 0xe5, 0xff)) return color_1 = Skin.get_background_color() if color_1 is not None: color_1 = color_1.copy().darken(0.12) else: color_1 = Color(0x00, 0x00, 0x00, 0x30) dc.draw_line(0, 0, size[0], 0, color_1) self.draw_background(self, dc, offset=1, height=size[1] - 1)
def __init__(self, parent): super().__init__(parent) # self.set_background_color(fsui.Color(0x999900)) # This min width is not important # self.set_min_width(400) horilayout = HorizontalLayout() self.layout.add(horilayout, fill=True, expand=True) vertlayout = VerticalLayout() horilayout.add(vertlayout, fill=True, expand=True) self.top_panel = Launcher2TopPanel(self) vertlayout.add(self.top_panel, fill=True) # self.running_panel = Launcher2RunningPanel(self) # vertlayout.add(self.running_panel, fill=True) # self.running_panel.set_visible(False) self.configpanel = ConfigPanel(self) # FIXME: Refer to theme? dialog_bg_color? self.configpanel.set_background_color( Color(Launcher2Colors.CONFIG_PANEL_COLOR) ) # self.configpanel.set_background_color(Color(0xBBBBBB)) vertlayout.add(self.configpanel, fill=True, expand=True) self.bottom_panel = Launcher2BottomPanel(self) self.layout.add(self.bottom_panel, fill=True) design_test = True if design_test: self.side = Launcher2SidePanel(self) horilayout.add(self.side, fill=True) # The Launcher should fit into a 1280x720 display, with # common/reasonable GUI elements such as a task bar. # Or maybe use 1366x768 # Or maybe 1280x768 to support 1280x1024 and 1366x768. # Windows 10 taskbar width/side: 62 pixels # Windows 10 taskbar height/bottom: 40 pixels # screen_size = (1280, 720) screen_size = (1366, 768) min_width = screen_size[0] - 62 # Subtracting an additional 40 For Launcher title bar min_height = screen_size[1] - 40 - 40 self.parent().set_min_size((min_width, min_height)) self.parent().left.set_min_width(380) self.parent().set_min_size((1280, 720 - 40)) # For now, make the minimum _client size_ 1280x720 which will cause # the window with decorations to be 1280x740. This should not be # the min. required size going forward though. Too big for # 768-height screens with bottom Windows 10 taskbar... # self.parent().set_min_size((1280, 720)) ConfigDispatch(self, {"__running": self.__on_running_config})
def on_activate(self): if self.dialog is not None: self.dialog.raise_() self.dialog.activateWindow() return from fsui.qt import QColorDialog # FIXME: Use accessor funtion get_qwindow # print("Initial color", Color.from_hex(get_settings(self).get(self.option))) # dialog = QColorDialog( # Color.from_hex(get_settings(self).get(self.option)), # parent=get_window(self)._real_window, # ) self.dialog = QColorDialog(parent=get_window(self)._qwidget) # dialog.setOption(QColorDialog.ShowAlphaChannel) self.dialog.setOption(QColorDialog.NoButtons) self.dialog.setOption(QColorDialog.DontUseNativeDialog) # Setting initial color only seems to work after setting options. # Calling this method earlier (or setting initial color in constructor) # seems to be ignored causing black color to be pre-selected. self.dialog.setCurrentColor( Color.from_hex(get_settings(self).get(self.option))) # dialog.colorSelected.connect(self.__color_selected) self.dialog.currentColorChanged.connect(self.__current_color_changed) self.dialog.destroyed.connect(self.__dialog_destroyed) # self.dialog.setAttribute(Qt.WA_DeleteOnClose) self.dialog.installEventFilter(self) self.dialog.show()
def __init__(self, parent): super().__init__(parent) horilayout = HorizontalLayout() self.layout.add(horilayout, fill=True, expand=True, margin=10) # self.set_background_color(Color(0xAEAEAE)) self.set_background_color(Color(0xB8B8B8)) horilayout.add(NewConfigButton(self), fill=True, margin_right=10) horilayout.add(SearchField(self), fill=True, expand=True)
def __init__(self, parent, image_loader): super().__init__(parent, -1, image_loader, None, None) image_size = COVER_SIZE self.set_size(image_size) self.set_min_size(image_size) self.image_size = image_size # self.set_background_color(Color(0x999999)) self.set_background_color(Color(0xC0C0C0))
def __init__(self, parent): super().__init__(parent) # parent.resized.connect(self.__parent_resized) get_window(self).resized.connect(self.__parent_resized) self.set_size((16, 16)) # self.set_background_color(Color(0x999999)) # self.set_background_color(Color(0xFF0000)) # self.set_background_color(Color(0xAEAEAE)) self.start_position = None self.start_size = None self.minimum_window_size = None self.set_resize_cursor() self.color1 = Color(0x666666) self.color2 = Color(0xD4D4D4) self.bgcolor = get_theme(self).window_bgcolor() self.set_background_color(self.bgcolor)
def __init__(self, visible=True): parent = ParentStack.top() super().__init__(parent) parent.layout.add(self) self.set_background_color(Color.from_hex("#ff0000")) # FIXME self.set_min_height(30) self.set_min_width(30) if not visible: self.set_visible(False)
def paint_element(self, dc): # orig_text_color = dc.get_text_color() if not self.active: dc.set_text_color(Color(0x80, 0x80, 0x80)) operations = self.get_draw_operations() for draw_type, draw_object, x, y in operations: if draw_type == "image": dc.draw_image(draw_object, x, y) elif draw_type == "text": # if not self.active: # dc.set_text_color(Color(0x80, 0x80, 0x80)) dc.draw_text(draw_object, x, y)
def __init__(self, parent=None, *args, style=None, **kwargs): super().__init__(parent=parent, *args, **kwargs) self.style = Style({"flexDirection": "column"}, style) backgroundColor = self.style.get("backgroundColor") if backgroundColor is not None: self.set_background_color(Color.from_hex(backgroundColor)) flex_layout = FlexLayout(self) for child in self.layout.children: flex_layout.add(child.element) self.layout = flex_layout
def draw_background(cls, widget, dc, offset=None, height=None): size = widget.size() if Skin.fws(): return x = 0 y = 0 w = size[0] h = size[1] if offset is not None: y += offset if height is not None: h = height color_1 = Skin.get_background_color() color_2 = color_1 # if fsui.System.macosx: # color_1 = Color(0xa7, 0xa7, 0xa7) # color_2 = Color(0xc0, 0xc0, 0xc0) if color_1 is not None: color_1 = color_1.copy().darken(0.08) else: color_1 = Color(0x00, 0x00, 0x00, 0x20) color_2 = Color(0x00, 0x00, 0x00, 0x00) dc.draw_vertical_gradient(x, y, w, h, color_1, color_2)
def __init__(self, parent, index, image_loader, default_image, overlay_image): super().__init__(parent) self.index = index self.image_size = SCREEN_SIZE self.set_size(self.image_size) self.set_background_color(Color(0x777777)) self._sha1 = "" self._request = None self._path = "" self.image_loader = image_loader self.default_image = default_image self.overlay_image = overlay_image self.image = self.default_image ConfigDispatch(self, {sha1_keys[index]: self.__on_sha1_config})
def on_paint(self): theme = get_theme(self) text = self.title if theme.titlebar_uppercase(): text = text.upper() _, wh = self.size() dc = self.create_dc() dc.set_font(theme.titlebar_font()) color = Color(0, 0, 0) dc.set_text_color(color) _, th = dc.measure_text(text) if self.menubutton: # Adding width of button (same as height). Also, adding 6 gives # 20 pixels between edge of burger icon and start of text. x = self.height + 6 else: x = 20 y = (wh - th) // 2 + 1 dc.draw_text(text, x, y)
def __init__(self, parent): super().__init__(parent) self.set_background_color(Color(0xFF0000)) from fsui.qt import QLabel, QParent, QPixmap self.label = QLabel(QParent(self)) pixmap = QPixmap("data/Background.jpg") # self._qwidget.setStyleSheet("border: 0px;") # self._qwidget.setContentsMargins(0, 0, 0, 0) # self._qwidget.move(0, 0) # self.label.setAutoFillBackground(True) # p = self.label.palette() # p.setColor(self.label.backgroundRole(), QColor(255, 0, 0)) # self.label.setPalette(p) self.label.setPixmap(pixmap) # self.label.setFrameShape(QFrame.NoFrame) # self.label.setLineWidth(0) self.label.setScaledContents(True)
def __init__(self, parent): super().__init__(parent, paintable=True) self.set_min_height(40) self.set_background_color(Color(0xFF, 0xFF, 0xFF)) self.menu_button = Button(self, "=") self.minimize_button = Button(self, "_") self.minimize_button.activated.connect(self.on_minimize_button) self.maximize_button = Button(self, "^") self.maximize_button.activated.connect(self.on_maximize_button) self.close_button = Button(self, "X") self.close_button.activated.connect(self.on_close_button) self.layout = HorizontalLayout() self.layout.add(self.menu_button, fill=True) self.layout.add_spacer(0, expand=True) self.layout.add(self.minimize_button, fill=True) self.layout.add(self.maximize_button, fill=True) self.layout.add(self.close_button, fill=True) self.window_pos = (-1, -1) self.mouse_pos = (-1, -1)
def __init__(self, parent): super().__init__(parent) self.set_background_color(Color(Launcher2Colors.SIDE_PANEL_COLOR)) # self.set_min_width(300) self.set_min_width(252 + 20 * 2) hori_layout = HorizontalLayout() self.layout.add( hori_layout, fill=True, margin_top=10, margin_right=20, margin_left=20, margin_bottom=0, ) self.choice = Choice( self, [ "Game front cover", ], ) hori_layout.add(self.choice, expand=True) self.choice.disable() # Currently not implemented # FIXME: Only enable button if screen is big enough for expanded # window? self.add_button = IconButton(self, "add_button.png") hori_layout.add(self.add_button, margin_left=10) self.add_button.disable() # Currently not implemented self.book = Book(self) self.layout.add(self.book, expand=True, fill=True) self.pages = [] self.pages.append(GameFrontCoverPanel(self.book)) for page in self.pages: self.book.add_page(page) self.book.set_page(self.pages[0])
def __init__(self, parent): ItemChoice.__init__(self, parent) self.parent_uuid = "" self.items = [] # type: list [dict] # self.last_variants = LastVariants() self.missing_color = Color(0xA8, 0xA8, 0xA8) self.icon = Image("launcher:/data/fsuae_config_16.png") self.adf_icon = Image("launcher:/data/adf_game_16.png") self.ipf_icon = Image("launcher:/data/ipf_game_16.png") self.cd_icon = Image("launcher:/data/cd_game_16.png") self.hd_icon = Image("launcher:/data/hd_game_16.png") # self.missing_icon = Image( # "launcher:/data/missing_game_16.png") self.missing_icon = Image("launcher:/data/16x16/delete_grey.png") self.blank_icon = Image("launcher:/data/16x16/blank.png") self.bullet_icon = Image("launcher:/data/16x16/bullet.png") self.manual_download_icon = Image( "launcher:/data/16x16/arrow_down_yellow.png") self.auto_download_icon = Image( "launcher:/data/16x16/arrow_down_green.png") self.up_icon = Image("launcher:/data/16x16/thumb_up_mod.png") self.down_icon = Image("launcher:/data/16x16/thumb_down_mod.png") self.fav_icon = Image("launcher:/data/rating_fav_16.png") # LauncherSettings.add_listener(self) # self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid")) ConfigDispatch( self, { PARENT_UUID: self.__on_parent_uuid_config, VARIANT_RATING__: self.on_variant_rating_config, }, )
def __init__(self): super().__init__() # self._titlebar_bgcolor = fsui.Color(0x888888) # self._titlebar_bgcolor_inactive = fsui.Color(0x999999) # self.__titlebar_bgcolor_text = "0x6688BB" # self._titlebar_bgcolor = Color.from_hex( # self._default_titlebar_bgcolor_text # ) # self._default_titlebar_bgcolor_inactive = fsui.Color(0x888888) black = Color(0, 0, 0) self._titlebar_bgcolor_default_str = "#6688BB" self._titlebar_bgcolor_inactive_default_str = "#888888" self._titlebar_fgcolor_default_str = "#000000" self._titlebar_fgcolor_inactive_default_str = "#444444" # self._window_bgcolor_default_str = "#AEAEAE" self._window_bgcolor_default_str = "#AAAAAA" self._titlebar_bgcolor = black self._titlebar_bgcolor_inactive = black self._titlebar_fgcolor = black self._titlebar_fgcolor_inactive = black self._window_bgcolor = black self._dialog_bgcolor_default_str = "#BBBBBB" self._dialog_bgcolor = black self._update_color("dialog_bgcolor", self._dialog_bgcolor_default_str) # self._titlebar_bgcolor = fsui.Color(0x6688BB) # self._titlebar_bgcolor_inactive = fsui.Color(0x888888) self._titlebar_font_default_str = "Saira Condensed Semi-Bold 19" # FIXME: Just set some default font here? self._titlebar_font = fsui.Font( **Font.parse("self._titlebar_font_default_str")) self._titlebar_height_default_str = "40" self._titlebar_height = 40 self._titlebar_uppercase_default_str = "1" self._titlebar_uppercase = True PADDING = (self.WIDGET_HEIGHT - 22) // 2 self._button_padding = Padding() self._button_padding.top = PADDING self._button_padding.bottom = PADDING self._choice_padding = Padding() self._choice_padding.top = PADDING self._choice_padding.bottom = PADDING self._textfield_padding = Padding() self._textfield_padding.top = PADDING self._textfield_padding.right = 4 self._textfield_padding.bottom = PADDING self._textfield_padding.left = 4 self.settings = LauncherSettings self.settings.add_listener(self) for option in ( "launcher_titlebar_bgcolor", "launcher_titlebar_bgcolor_inactive", "launcher_titlebar_fgcolor", "launcher_titlebar_fgcolor_inactive", "launcher_titlebar_font", "launcher_titlebar_height", "launcher_titlebar_uppercase", "launcher_window_bgcolor", ): self.on_setting(option, self.settings.get(option))
def __init__(self, parent, *, close=False, quit=False): super().__init__(parent) panel = Panel(self) panel.set_min_height(1) panel.set_background_color(Color(0x888888)) self.layout.add(panel, fill=True) horilayout = HorizontalLayout() self.layout.add( horilayout, fill=True, expand=True, margin_top=10, margin_right=10, margin_bottom=10, ) if close: button = Button(self, label="Close") button.activated.connect(self.__on_close) horilayout.add(button, margin_left=10) if quit: button = Button(self, label="Quit") button.activated.connect(self.__on_quit) horilayout.add(button, margin_left=10) button = Button(self, label="Settings") button.activated.connect(self.__on_settings) horilayout.add(button, margin_left=10) button = Button(self, label="Launcher") button.activated.connect(self.__on_launcher) horilayout.add(button, margin_left=10) button = Button(self, label="Prefs") button.activated.connect(self.__on_prefs) horilayout.add(button, margin_left=10) button = Button(self, label="Advanced") button.activated.connect(self.__on_advanced_prefs) horilayout.add(button, margin_left=10) button = Button(self, label="Appearance") button.activated.connect(self.__on_appearance_prefs) horilayout.add(button, margin_left=10) button = Button(self, label="WHDLoad") button.activated.connect(self.__on_whdload_prefs) horilayout.add(button, margin_left=10) button = Button(self, label="LoadWB") button.activated.connect(self.__on_loadwb) horilayout.add(button, margin_left=10) button = Button(self, label="UH") button.activated.connect(self.__on_unhandled_exception) horilayout.add(button, margin_left=10) button = Button(self, label="UH2") button.activated.connect(self.__on_unhandled_exception_2) horilayout.add(button, margin_left=10) button = Button(self, label="UH3") button.activated.connect(self.__on_unhandled_exception_3) horilayout.add(button, margin_left=10) button = Button(self, label="GC") button.activated.connect(self.__on_garbage_collector) horilayout.add(button, margin_left=10)
def __init__(self, parent): super().__init__(parent) self.layout = HorizontalLayout() self.title = get_workspace_window_title() self.dragging = False self.dragging_mouse_origin = (0, 0) self.dragging_window_origin = (0, 0) self.buttons = [] theme = get_theme(self) self.height = theme.titlebar_height() self.set_min_height(self.height) button_size = (self.height, self.height) # fgcolor = theme.titlebar_fgcolor() # fgcolor_inactive = theme.titlebar_fgcolor_inactive() fgcolor = Color(0x000000) fgcolor_inactive = Color(0x000000) self.set_background_color(Color(0xFFFFFF)) menu = True if menu: self.menubutton = TitleBarButton( self, icon_name="TitleBarMenu", size=button_size, fgcolor=fgcolor, fgcolor_inactive=fgcolor_inactive, ) self.menubutton.activated.connect(self.__on_menu_activated) self.layout.add(self.menubutton) self.buttons.append(self.menubutton) else: self.menubutton = None self.layout.add_spacer(0, expand=True) self.volumebutton = VolumeButton(self) self.layout.add(self.volumebutton) self.monitorbutton = MonitorButton(self) self.layout.add(self.monitorbutton) self.fullscreenbutton = FullscreenToggleButton(self) self.layout.add(self.fullscreenbutton) self._window_active = True # parent.activated.connect(self.__on_window_activated) # parent.deactivated.connect(self.__on_window_deactivated) # FIXME: Would be better to do this via theme instead and get a theme # updated notification. Works well enough for now. for option in [ "launcher_titlebar_font", "launcher_titlebar_height", "launcher_titlebar_uppercase", ]: self.on_setting( option, get_settings(self).get(option), ) get_settings(self).add_listener(self)
def __init__(self, parent): VerticalItemView.__init__(self, parent, border=False) self.items = [] self.game_icon = Image("launcher:/data/16x16/controller.png") self.config_icon = Image("launcher:/data/fsuae_config_16.png") LauncherSettings.add_listener(self) self.update_search() self.manual_download_icon = Image( "launcher:/data/16x16/arrow_down_yellow.png") self.auto_download_icon = Image( "launcher:/data/16x16/arrow_down_green.png") self.blank_icon = Image("launcher:/data/16x16/blank.png") self.missing_color = Color(0xA8, 0xA8, 0xA8) self.unpublished_color = Color(0xCC, 0x00, 0x00) self.platform_icons = {} self.set_background_color(Color(0x999999)) self.set_font(Font("Saira Condensed", 17, weight=500)) self.set_row_height(32) get_window(self).activated.connect(self.__on_activated) get_window(self).deactivated.connect(self.__on_deactivated) self._qwidget.verticalScrollBar().setStyleSheet(f""" QScrollBar:vertical {{ border: 0px; /* background: #32CC99; */ /* background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #888888, stop: 1 #909090); */ /* background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #848484, stop: 0.0625 #8A8A8A stop: 1 #909090); */ background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #858585, stop: {1 / (16 - 1)} #8A8A8A stop: 1 #909090); width: 16px; margin: 0 0 0 0; }} QScrollBar::handle:vertical {{ /* background: #9d9d9d; */ background: #999999; background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #AAAAAA stop: 1 #999999); min-height: 60px; }} QScrollBar::handle:vertical:hover {{ background: #AAAAAA; background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #B2B2B2 stop: 1 #A0A0A0); }} QScrollBar::handle:vertical:pressed {{ background: #777777; }} QScrollBar::add-line:vertical {{ border: none; background: none; width: 0; height: 0; }} QScrollBar::sub-line:vertical {{ border: none; background: none; width: 0; height: 0; }} """)
def __init__(self, parent): super().__init__(parent) # Skin.set_background_color(self) # self.set_background_color(get_theme(self).window_bgcolor()) # self.set_background_color(Color(0, 255, 0)) self.set_background_color(Color(0, 0, 0, 0))
def on_setting(self, option, value): if option == self.option: color = Color.from_hex(value) if color != self.color: self.color = color self.refresh()
def __init__(self, parent, *, exception, backtrace, recoverable=False): self.theme = get_launcher_theme(self) window_parent = None if recoverable: title = "Recoverable Alert" else: title = "Software Failure" minimizable = False maximizable = False super().__init__(window_parent, title, border=False) self.layout = VerticalLayout() if recoverable: text_color = Color(0xFFAA22) # background_color = Color(0x111111) title_foreground_color = Color(0x000000) title_background_color = Color(0xFFAA22) else: text_color = Color(0xFF2222) title_foreground_color = Color(0x000000) title_background_color = Color(0xFF2222) background_color = Color(0x181818) self.set_background_color(background_color) if not self.theme.titlebar_system(): self.__titlebar = TitleBar( self, title=title, minimizable=minimizable, maximizable=maximizable, # foreground_color=Color(0xFFFFFF), # background_color=Color(0x282828), foreground_color=title_foreground_color, background_color=title_background_color, foreground_inactive_color=Color(0xCCCCCC), background_inactive_color=Color(0x333333), ) self.layout.add(self.__titlebar, fill=True) self.errorpanel = ExceptionPanel(self, title, exception, background_color, text_color) self.layout.add(self.errorpanel, fill=True, expand=True) # FIXME: For frozen version, we might want to clean up the file # references, so absolute paths from the development host is removed. text = f"{exception}\n\n{backtrace}" self.textarea = TextArea( self, text=text, read_only=True, border=False, text_color=Color(0xFFFFFF), background_color=background_color, padding=20, ) self.textarea.set_min_size((640, 320)) # FIXME: Include a suitable fixed-with font with the launcher and use # that? This font might not be available. self.textarea.set_font(Font("Courier New", 14)) self.textarea.scroll_to_start() self.layout.add(self.textarea, fill=True, expand=True)
def __current_color_changed(self, color): get_settings(self).set(self.option, Color(color).to_hex())
def __init__(self, parent): super().__init__(parent, vertical_layout=True, textcolor=Color(0xFFFFFF)) for volume in shell_volumes(): self.add_launcher_icon(volume)
def __init__(self, parent, *, vertical_layout=False, textcolor=None): super().__init__(parent) # self.set_background_color(fsui.Color(0x006699)) self.vertical_layout = vertical_layout # self.set_background_color(fsui.Color(0x808080)) self.panel = Panel(self) # self.panel.set_background_color(fsui.Color(0x009900)) # self.panel.set_background_color(None) # FIXME: Why is it necessary to set a transparent color here? Shouldn't # it be sufficient to let the panel have its autoFillBackground set # to False (default)? self.panel.set_background_color(Color(0, 0, 0, 0)) # self.panel._widget.setAutoFillBackground(False) self.icons = [] if textcolor: self.textcolor = textcolor else: self.textcolor = Color(0x000000) # FIXME: Fix fsui.ScrollArea / Panel constructor so this isn't # necessary? (Child calls method on parent when parenting) self.set_child(self.panel) # self.panel.set_size((1400, 200)) # self._qwidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) # self._qwidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) # # Base: 9999 # g1 = "#858585" # g2 = "#8A8A8A" # g3 = "#909090" # # Handle gradient # hg1 = "#AAAAAA" # hg2 = "#999999" # # Handle hover gradient # hhg1 = "#B2B2B2" # hhg2 = "#A0A0A0" # # Handle pressed color # hpc = "#777777" # Base: AEAEAE g1 = "#959595" g2 = "#9A9A9A" g3 = "#A0A0A0" # Handle gradient hg1 = "#BBBBBB" hg2 = "#AEAEAE" # Handle hover gradient hhg1 = "#BEBEBE" hhg2 = "#B4B4B4" # Handle pressed color hpc = "#8C8C8C" scrollbar_stylesheet = f""" QScrollBar:vertical {{ border: 0px; background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 {g1}, stop: {1 / (16 - 1)} {g2} stop: 1 {g3}); width: 16px; margin: 0 0 0 0; }} QScrollBar:horizontal {{ border: 0px; background-color: qlineargradient(x1: 0, y1: 0 x2: 0, y2: 1, stop: 0 {g1}, stop: {1 / (16 - 1)} {g2} stop: 1 {g3}); height: 16px; margin: 0 0 0 0; }} QScrollBar::handle:vertical {{ /* background: #999999; */ background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 {hg1} stop: 1 {hg2}); min-height: 60px; }} QScrollBar::handle:horizontal {{ background-color: qlineargradient(x1: 0, y1: 0 x2: 0, y2: 1, stop: 0 {hg1} stop: 1 {hg2}); min-height: 60px; }} QScrollBar::handle:vertical:hover {{ background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 {hhg1} stop: 1 {hhg2}); }} QScrollBar::handle:horizontal:hover {{ background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 {hhg1} stop: 1 {hhg2}); }} QScrollBar::handle:vertical:pressed {{ background: {hpc}; }} QScrollBar::handle:horizontal:pressed {{ background: {hpc}; }} QScrollBar::add-line:vertical {{ border: none; background: none; width: 0; height: 0; }} QScrollBar::add-line:horizontal {{ border: none; background: none; width: 0; height: 0; }} QScrollBar::sub-line:vertical {{ border: none; background: none; width: 0; height: 0; }} QScrollBar::sub-line:horizontal {{ border: none; background: none; width: 0; height: 0; }} """ self._qwidget.horizontalScrollBar().setStyleSheet(scrollbar_stylesheet) self._qwidget.verticalScrollBar().setStyleSheet(scrollbar_stylesheet)