Skip to content

Commit

Permalink
Windows XP compatibility upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
matkuki committed Aug 19, 2021
1 parent ea01f23 commit 403d299
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 76 deletions.
2 changes: 1 addition & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create_icon(icon_name):
def get_resource_file(relative_path):
path = unixify_path_join(data.resources_directory, relative_path)
if not os.path.isfile(path):
raise Exception(f"[Resources] File does not exist: {path}")
raise Exception("[Resources] File does not exist: {}".format(path))
return path

pixmap_cache = {}
Expand Down
11 changes: 7 additions & 4 deletions gui/baseeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ def set_theme(self, theme):
self.setCaretLineBackgroundColor(
theme.Cursor_Line_Background
)
self.setStyleSheet(f"""
self.setStyleSheet("""
BaseEditor {{
border: 0px;
background-color: {data.theme.Indication.PassiveBackGround};
background-color: {};
padding: 0px;
spacing: 0px;
margin: 0px;
}}
{StyleSheetScrollbar.full()}
""")
{}
""".format(
data.theme.Indication.PassiveBackGround,
StyleSheetScrollbar.full(),
))
49 changes: 32 additions & 17 deletions gui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3525,9 +3525,9 @@ def hide_settings_gui_manipulator(self):
self._parent.settings.gui_manipulator.hide()

def init_style_sheet(self):
style_sheet = (f"""
style_sheet = ("""
#Form {{
background-color: {data.theme.Form};
background-color: {};
border: 0px;
}}
#Main_Groupbox {{
Expand All @@ -3539,10 +3539,14 @@ def init_style_sheet(self):
width: 4px;
}}
QSplitter::handle {{
background: {data.theme.Form};
background: {};
}}
{StyleSheetScrollbar.full()}
""")
{}
""".format(
data.theme.Form,
data.theme.Form,
StyleSheetScrollbar.full()
))
return style_sheet

def reset_window_colors(self, in_sheet):
Expand All @@ -3561,35 +3565,46 @@ def reset_entire_style_sheet(self):
self.indication_check()

def generate_window_colors(self):
style_sheet = f"""
style_sheet = """
TabWidget::pane {{
border: 2px solid {data.theme.Indication.PassiveBorder};
background-color: {data.theme.Indication.PassiveBackGround};
border: 2px solid {};
background-color: {};
margin: 0px;
spacing: 0px;
padding: 0px;
}}
TabWidget[indicated=false]::pane {{
border: 2px solid {data.theme.Indication.PassiveBorder};
background-color: {data.theme.Indication.PassiveBackGround};
border: 2px solid {};
background-color: {};
}}
TabWidget[indicated=true]::pane {{
border: 2px solid {data.theme.Indication.ActiveBorder};
background-color: {data.theme.Indication.ActiveBackGround};
border: 2px solid {};
background-color: {};
}}
TabWidget QToolButton {{
background: {data.theme.Indication.PassiveBackGround};
border: 1px solid {data.theme.Indication.PassiveBorder};
background: {};
border: 1px solid {};
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 1px;
}}
TabWidget QToolButton:hover {{
background: {data.theme.Indication.ActiveBackGround};
border: 1px solid {data.theme.Indication.ActiveBorder};
background: {};
border: 1px solid {};
}}
"""
""".format(
data.theme.Indication.PassiveBorder,
data.theme.Indication.PassiveBackGround,
data.theme.Indication.PassiveBorder,
data.theme.Indication.PassiveBackGround,
data.theme.Indication.ActiveBorder,
data.theme.Indication.ActiveBackGround,
data.theme.Indication.PassiveBackGround,
data.theme.Indication.PassiveBorder,
data.theme.Indication.ActiveBackGround,
data.theme.Indication.ActiveBorder,
)
return style_sheet

def generate_treedisplay_colors(self, type):
Expand Down
31 changes: 20 additions & 11 deletions gui/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,24 @@ def __init__(self, *args, **kwargs):
self.setFont(data.get_current_font())

def update_style(self):
self.setStyleSheet(f"""
self.setStyleSheet("""
QMenu {{
background-color: {data.theme.Indication.PassiveBackGround};
border: 1px solid {data.theme.Indication.PassiveBorder};
color: {data.theme.Font.DefaultHtml}
background-color: {};
border: 1px solid {};
color: {}
}}
QMenu::item {{
background-color: transparent;
}}
QMenu::item:selected {{
background-color: {data.theme.Indication.Hover};
background-color: {};
}}
""")
""".format(
data.theme.Indication.PassiveBackGround,
data.theme.Indication.PassiveBorder,
data.theme.Font.DefaultHtml,
data.theme.Indication.Hover,
))


class MenuBar(data.QMenuBar):
Expand All @@ -80,18 +85,22 @@ def __init__(self, *args, **kwargs):
self.update_style()

def update_style(self):
self.setStyleSheet(f"""
self.setStyleSheet("""
QMenuBar {{
background-color: {data.theme.Indication.PassiveBackGround};
color: {data.theme.Font.DefaultHtml};
background-color: {};
color: {};
}}
QMenuBar::item {{
background-color: transparent;
}}
QMenuBar::item:selected {{
background-color: {data.theme.Indication.Hover};
background-color: {};
}}
""")
""".format(
data.theme.Indication.PassiveBackGround,
data.theme.Font.DefaultHtml,
data.theme.Indication.Hover,
))



Expand Down
17 changes: 11 additions & 6 deletions gui/replbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def set_style(self, indicated):
else:
background = data.theme.Indication.PassiveBackGround
border = data.theme.Indication.PassiveBorder
self.setStyleSheet(f"""
self.setStyleSheet("""
#REPL_Box {{
font-size: 8pt;
font-weight: bold;
color: {border};
background-color: {data.theme.Indication.PassiveBackGround};
border: 2px solid {border};
color: {};
background-color: {};
border: 2px solid {};
border-radius: 0px;
margin-top: 6px;
margin-bottom: 0px;
Expand All @@ -105,12 +105,17 @@ def set_style(self, indicated):
padding-right: 0px;
}}
#REPL_Box::title {{
color: {data.theme.Indication.ActiveBorder};
color: {};
subcontrol-position: top left;
padding: 0px;
left: 8px;
top: -6px;
}}
""")
""".format(
border,
data.theme.Indication.PassiveBackGround,
border,
data.theme.Indication.ActiveBorder,
))


17 changes: 11 additions & 6 deletions gui/repllineedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,21 @@ def __init__(self, parent, main_form, interpreter_references=None):

def update_style(self):
# REPL and REPL helper have to be set directly
self.setStyleSheet(f"""
self.setStyleSheet("""
QLineEdit[indicated=false] {{
color: {data.theme.Font.DefaultHtml};
background-color: {data.theme.Indication.PassiveBackGround};
color: {};
background-color: {};
}}
QLineEdit[indicated=true] {{
color: {data.theme.Font.DefaultHtml};
background-color: {data.theme.Indication.ActiveBackGround};
color: {};
background-color: {};
}}
""")
""".format(
data.theme.Font.DefaultHtml,
data.theme.Indication.PassiveBackGround,
data.theme.Font.DefaultHtml,
data.theme.Indication.ActiveBackGround,
))

def indication_set(self):
self.setProperty("indicated", True)
Expand Down
41 changes: 27 additions & 14 deletions gui/stylesheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ def horizontal():
color_background = data.theme.ScrollBar.background
color_handle = data.theme.ScrollBar.handle
color_handle_hover = data.theme.ScrollBar.handle_hover
style_sheet = f"""
style_sheet = """
QScrollBar:horizontal {{
border: none;
background: {color_background};
height: {height}px;
background: {};
height: {}px;
margin: 0px 0px 0px 0px;
}}
QScrollBar::handle:horizontal {{
background: {color_handle};
background: {};
min-width: 20px;
}}
QScrollBar::handle:hover {{
background: {color_handle_hover};
background: {};
}}
QScrollBar::handle:horizontal:pressed {{
background: {color_handle_hover};
background: {};
}}
QScrollBar::sub-line:horizontal, QScrollBar::add-line:horizontal,
Expand All @@ -48,7 +48,13 @@ def horizontal():
width: 0px;
height: 0px;
}}
"""
""".format(
color_background,
height,
color_handle,
color_handle_hover,
color_handle_hover,
)
return style_sheet

@staticmethod
Expand All @@ -58,22 +64,22 @@ def vertical():
color_background = data.theme.ScrollBar.background
color_handle = data.theme.ScrollBar.handle
color_handle_hover = data.theme.ScrollBar.handle_hover
style_sheet = f"""
style_sheet = """
QScrollBar:vertical {{
border: none;
background: {color_background};
width: {width}px;
background: {};
width: {}px;
margin: 0px 0px 0px 0px;
}}
QScrollBar::handle:vertical {{
background: {color_handle};
background: {};
min-height: 20px;
}}
QScrollBar::handle:hover {{
background: {color_handle_hover};
background: {};
}}
QScrollBar::handle:vertical:pressed {{
background: {color_handle_hover};
background: {};
}}
QScrollBar::sub-line:vertical, QScrollBar::add-line:vertical,
Expand All @@ -83,7 +89,14 @@ def vertical():
width: 0px;
height: 0px;
}}
"""
""".format(
color_background,
width,
color_handle,
color_handle_hover,
color_handle_hover,

)
return style_sheet

@staticmethod
Expand Down
Loading

0 comments on commit 403d299

Please sign in to comment.