Skip to content

Commit acf6d9e

Browse files
committed
Update window.py
1 parent 0026def commit acf6d9e

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/gui/window.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,30 @@ def __init__(self, *args, **kwargs):
9999

100100
self._env_detection()
101101

102+
# Switch between ViewSwitcherTitle and ViewSwitcherBar based on the Adw.Breakpoint status
103+
def _setup_switcher_responsive(self):
104+
self.break_point = Adw.Breakpoint.new(
105+
Adw.BreakpointCondition.parse("max-width: 400sp")
106+
)
107+
108+
# When activating a narrow breakpoint, display the switcher_bar
109+
self.apply_handler = self.break_point.connect("apply", self.__on_break_point_apply)
110+
111+
# Hide switcher_bar when narrow breakpoint is deactivated
112+
self.unapply_handler = self.break_point.connect("unapply", self.__on_break_point_unapply)
113+
114+
# Add a breakpoint to the window
115+
self.add_breakpoint(self.break_point)
116+
117+
# Default state - hidden (only displayed when the breakpoint is met)
118+
self.switcher_bar.set_reveal(False)
119+
120+
def __on_break_point_apply(self, break_point):
121+
self.switcher_bar.set_reveal(True)
122+
123+
def __on_break_point_unapply(self, break_point):
124+
self.switcher_bar.set_reveal(False)
125+
102126
# If the user has a supported environment, it shows the app window, otherwise, it shows the window with information about an unsupported environment
103127
def _env_detection(self):
104128
def setup_environment(env_name):
@@ -139,30 +163,6 @@ def setup_environment(env_name):
139163
self.toolbarview.set_content(self.pBox)
140164
self.unsupp_label = Gtk.Label.new(str=f'<big>{_("<big><b>You have an unsupported environment installed.</b></big>\nPlease use one of these environments: {}.")}</big>'.format(', '.join(set(desktop_map.values())))); self.unsupp_label.set_use_markup(True); self.unsupp_label.set_justify(Gtk.Justification.CENTER); self.unsupp_label.set_wrap(True); self.pBox.append(self.unsupp_label)
141165

142-
# Switch between ViewSwitcherTitle and ViewSwitcherBar based on the Adw.Breakpoint status
143-
def _setup_switcher_responsive(self):
144-
self.break_point = Adw.Breakpoint.new(
145-
Adw.BreakpointCondition.parse("max-width: 400sp")
146-
)
147-
148-
# When activating a narrow breakpoint, display the switcher_bar
149-
self.apply_handler = self.break_point.connect("apply", self.__on_break_point_apply)
150-
151-
# Hide switcher_bar when narrow breakpoint is deactivated
152-
self.unapply_handler = self.break_point.connect("unapply", self.__on_break_point_unapply)
153-
154-
# Add a breakpoint to the window
155-
self.add_breakpoint(self.break_point)
156-
157-
# Default state - hidden (only displayed when the breakpoint is met)
158-
self.switcher_bar.set_reveal(False)
159-
160-
def __on_break_point_apply(self, break_point):
161-
self.switcher_bar.set_reveal(True)
162-
163-
def __on_break_point_unapply(self, break_point):
164-
self.switcher_bar.set_reveal(False)
165-
166166
# Show main page
167167
def save_desktop(self):
168168
# Set valign for the save desktop layout

0 commit comments

Comments
 (0)