File tree Expand file tree Collapse file tree 10 files changed +141
-0
lines changed Expand file tree Collapse file tree 10 files changed +141
-0
lines changed Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ gi .require_version ("Adw" , "1" )
5+ from gi .repository import Gtk , Adw
6+ import workbench
7+
8+ breakpoint : Adw .Breakpoint = workbench .builder .get_object ("breakpoint" )
9+
10+ breakpoint .connect ("apply" , lambda _widget : print ("Breakpoint Applied" ))
11+ breakpoint .connect ("unapply" , lambda _widget : print ("Breakpoint Unapplied" ))
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ from gi .repository import Gtk
5+ import workbench
6+
7+ emoji_chooser : Gtk .EmojiChooser = workbench .builder .get_object ("emoji_chooser" )
8+ button : Gtk .Button = workbench .builder .get_object ("button" )
9+
10+ emoji_chooser .connect ("emoji-picked" , lambda _chooser , emoji : button .set_label (emoji ))
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ gi .require_version ("Gio" , "2.0" )
5+ from gi .repository import Gtk , Gio
6+ import workbench
7+
8+ path : Gio .File = Gio .File .new_for_uri (workbench .resolve ("workbench.png" )).get_path ()
9+
10+ workbench .builder .get_object ("icon1" ).set_from_file (path )
11+ workbench .builder .get_object ("icon2" ).set_from_file (path )
12+ workbench .builder .get_object ("icon3" ).set_from_file (path )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ from gi .repository import Gtk
5+ import workbench
6+
7+ linkbutton : Gtk .LinkButton = workbench .builder .get_object ("linkbutton" )
8+
9+
10+ def on_activate_link (button : Gtk .LinkButton ):
11+ print (f"About to activate { button .get_uri ()} " )
12+
13+ # Return True if handling the link manually, or
14+ # False to let the default behavior continue
15+ return False
16+
17+
18+ linkbutton .connect (
19+ "notify::visited" , lambda _widget , _params : print ("The link has been visited" )
20+ )
21+ linkbutton .connect ("activate-link" , on_activate_link )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ gi .require_version ("Adw" , "1" )
5+ from gi .repository import Gtk , Adw
6+ import workbench
7+
8+ circular_switch : Adw .SwitchRow = workbench .builder .get_object ("circular_switch" )
9+ secondary_button : Gtk .MenuButton = workbench .builder .get_object ("secondary" )
10+
11+
12+ def update_css (_widget , _params ):
13+ if circular_switch .get_active ():
14+ secondary_button .add_css_class ("circular" )
15+ else :
16+ secondary_button .remove_css_class ("circular" )
17+
18+
19+ circular_switch .connect ("notify::active" , update_css )
20+
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ gi .require_version ("Gio" , "2.0" )
5+ from gi .repository import Gtk , Gio
6+ import workbench
7+
8+ file : Gio .File = Gio .File .new_for_uri (workbench .resolve ("./image.png" ))
9+
10+ picture : Gtk .Picture = workbench .builder .get_object ("picture" )
11+ picture .set_file (file )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ from gi .repository import Gtk
5+ import workbench
6+
7+
8+ def onClosed (popover ):
9+ name = popover .get_name ()
10+ print (f"{ name } closed." )
11+
12+
13+ popover_ids = ("plain_popover" , "popover_menu" )
14+
15+ for id in popover_ids :
16+ popover = workbench .builder .get_object (id )
17+ popover .connect ("closed" , onClosed )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ from gi .repository import Gtk
5+ import workbench
6+
7+ radio_button_1 : Gtk .CheckButton = workbench .builder .get_object ("radio_button_1" )
8+ radio_button_2 : Gtk .CheckButton = workbench .builder .get_object ("radio_button_2" )
9+
10+ radio_button_1 .connect ("toggled" , lambda widget : on_toggled (widget , "Force Light Mode" ))
11+ radio_button_2 .connect ("toggled" , lambda widget : on_toggled (widget , "Force Dark Mode" ))
12+
13+
14+ def on_toggled (radio_button : Gtk .CheckButton , message ):
15+ if radio_button .get_active ():
16+ print (message )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ gi .require_version ("Gio" , "2.0" )
5+ from gi .repository import Gtk , Gio
6+ import workbench
7+
8+ picture_one : Gtk .Picture = workbench .builder .get_object ("picture_one" )
9+ picture_two : Gtk .Picture = workbench .builder .get_object ("picture_two" )
10+
11+ file : Gio .File = Gio .File .new_for_uri (workbench .resolve ("./image.png" ))
12+
13+ picture_one .set_file (file )
14+ picture_two .set_file (file )
Original file line number Diff line number Diff line change 1+ import gi
2+
3+ gi .require_version ("Gtk" , "4.0" )
4+ from gi .repository import Gtk
5+ import workbench
6+
7+ basic_label : Gtk .Label = workbench .builder .get_object ("basic_label" )
8+
9+ basic_label .add_css_class ("css_text" )
You can’t perform that action at this time.
0 commit comments