Skip to content

Commit

Permalink
Add a fullscreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Nov 2, 2020
1 parent da37a41 commit c853d54
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
4 changes: 4 additions & 0 deletions usr/lib/hypnotix/hypnotix.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(self, application):
self.status_bar = self.builder.get_object("status_bar")
self.stack = self.builder.get_object("stack")
self.fullscreen_box = self.builder.get_object("fullscreen_box")
self.fullscreen_button = self.builder.get_object("fullscreen_button")
self.fullscreen_widgets = []
self.fullscreen_widgets.append(self.builder.get_object("sidebar"))
self.fullscreen_widgets.append(self.headerbar)
Expand All @@ -95,6 +96,7 @@ def __init__(self, application):
self.window.connect("key-press-event",self.on_key_press_event)
self.mpv_drawing_area.connect("realize", self.on_mpv_drawing_area_realize)
self.mpv_drawing_area.connect("draw", self.on_mpv_drawing_area_draw)
self.fullscreen_button.connect("clicked", self.on_fullscreen_button_clicked)

# Menubar
accel_group = Gtk.AccelGroup()
Expand Down Expand Up @@ -319,6 +321,8 @@ def toggle_fullscreen(self):
widget.set_visible(True)
self.main_box.set_border_width(12)

def on_fullscreen_button_clicked(self, widget):
self.toggle_fullscreen()

if __name__ == "__main__":
application = MyApplication("org.x.hypnotix", Gio.ApplicationFlags.FLAGS_NONE)
Expand Down
30 changes: 29 additions & 1 deletion usr/share/hypnotix/hypnotix.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,32 @@
<child>
<placeholder/>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
<object class="GtkButton" id="fullscreen_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Fullscreen</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">view-fullscreen-symbolic</property>
<property name="icon_size">2</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
Expand All @@ -50,6 +74,10 @@
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
Expand Down
6 changes: 3 additions & 3 deletions usr/share/hypnotix/shortcuts.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Blah</property>
<property name="title" translatable="yes">Main shortcuts</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Blah</property>
<property name="accelerator">F11 f</property>
<property name="title" translatable="yes">Toggle Fullscreen</property>
</object>
</child>
</object>
Expand Down

0 comments on commit c853d54

Please sign in to comment.