Exemple #1
0
    def __init__(self, parent, icon, title):
        super().__init__(parent)
        self.layout = fsui.HorizontalLayout()
        # FIXME: From Theme
        self.set_background_color(fsui.Color(0xFF, 0xFF, 0xFF))

        self.title_label = fsui.HeadingLabel(self, title)
        font = fsui.Font("Roboto", 26)
        self.title_label.set_font(font)
        self.layout.add(self.title_label, expand=True, fill=True, margin=20)
        self.layout.add_spacer(20)
        self.layout.add(fsui.ImageView(self, icon.image(48)), margin_right=20)
Exemple #2
0
    def __init__(self):
        self.title_font = fsui.Font("Noto Sans", 15)
        # self.title_color = fsui.Color(0x80, 0x80, 0x80)
        self.title_color = fsui.Color(0x44, 0x44, 0x44)
        self.title_background = fsui.Color(0xFF, 0xFF, 0xFF)
        # self.title_separator_color = fsui.Color(0xe5, 0xe5, 0xe5)
        self.title_separator_color = fsui.Color(0xCC, 0xCC, 0xCC)
        self.window_background = fsui.Color(0xF2, 0xF2, 0xF2)
        # self.sidebar_background = fsui.Color(0xeb, 0xeb, 0xeb)
        self.sidebar_background = fsui.Color(0xE2, 0xE2, 0xE2)
        self.selection_background = fsui.Color(0x40, 0x80, 0xFF)

        self.title_glow_color = None
Exemple #3
0
    def __init__(self, parent, text="", font=None):
        super().__init__(parent, text)
        if font is not None:
            if isinstance(font, str):
                size, weight, family = font.split(" ", 3)
                assert size.endswith("px")
                font = QFont(family)
                font.setPixelSize(int(size[:-2]))
                weight = weight.lower()
                if weight == "regular":
                    font.setWeight(QFont.Normal)
                elif weight == "medium":
                    font.setWeight(QFont.DemiBold)
                elif weight == "bold":
                    font.setWeight(QFont.Bold)
                else:
                    raise Exception("Unknown weight")
                font = fsui.Font(font)

            self.set_font(font)
    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 __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))