-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
brunnme
committed
Sep 28, 2020
0 parents
commit 9ab2356
Showing
8 changed files
with
1,381 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import gi | ||
gi.require_version("Gtk", "3.0") | ||
from gi.repository import Gtk, Gdk, GLib | ||
|
||
class Handler: | ||
def __init__(self, builder): | ||
self.builder = builder | ||
|
||
def onDestroy(self, *args): | ||
Gtk.main_quit() | ||
|
||
if __name__ == "__main__": | ||
builder = Gtk.Builder() | ||
builder.add_from_file("./gui.glade") | ||
builder.connect_signals(Handler(builder)) | ||
|
||
screen = Gdk.Screen.get_default() | ||
provider = Gtk.CssProvider() | ||
provider.load_from_path("./style.css") | ||
Gtk.StyleContext.add_provider_for_screen( | ||
screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) | ||
|
||
window = builder.get_object("winApp") | ||
window.show_all() | ||
|
||
Gtk.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import gi | ||
gi.require_version("Gtk", "3.0") | ||
from gi.repository import Gtk | ||
|
||
class myApp: | ||
def __init__(self): | ||
self.window = Gtk.Window() | ||
self.window.set_title("Hello World") | ||
self.window.connect( | ||
"destroy", | ||
self.onDestroy | ||
) | ||
self.hbox = Gtk.HBox() | ||
self.label = Gtk.Label("Hello World") | ||
self.button = Gtk.Button("Close") | ||
self.button.connect( | ||
"clicked", | ||
self.onClick | ||
) | ||
self.hbox.add(self.label) | ||
self.hbox.add(self.button) | ||
self.window.add(self.hbox) | ||
self.window.show_all() | ||
|
||
def onDestroy(self, *args): | ||
Gtk.main_quit() | ||
|
||
def onClick(self, *args): | ||
Gtk.main_quit() | ||
|
||
app = myApp() | ||
Gtk.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/python3 | ||
|
||
import gi | ||
gi.require_version("Gtk", "3.0") | ||
from gi.repository import Gtk, Gdk, GLib | ||
import subprocess | ||
|
||
class Handler: | ||
def __init__(self, builder): | ||
self.builder = builder | ||
|
||
def onDestroy(self, *args): | ||
Gtk.main_quit() | ||
|
||
def on_bntStart_clicked(self, *args): | ||
self.builder.get_object("msgAbout").run() | ||
|
||
def on_btnAboutOk_clicked(self, *args): | ||
self.builder.get_object("msgAbout").hide() | ||
self.builder.get_object("winApp").hide() | ||
self.builder.get_object("winContent").show() | ||
self.builder.get_object("lblTitle").set_label( | ||
self.builder.get_object("notePages").get_tab_label_text( | ||
self.builder.get_object("notePages").get_nth_page(0) | ||
) | ||
) | ||
|
||
def on_btnNext_clicked(self, *args): | ||
self.builder.get_object("notePages").next_page() | ||
|
||
def on_btnPrev_clicked(self, *args): | ||
self.builder.get_object("notePages").prev_page() | ||
|
||
def on_btnExit_clicked(self, *args): | ||
self.onDestroy() | ||
|
||
def on_notePages_switch_page(self, *args): | ||
pages = args[0].get_n_pages() | ||
self.builder.get_object("lblTitle").set_label(args[0].get_tab_label_text(args[1])) | ||
if args[2] == 0: | ||
self.builder.get_object("btnPrev").set_sensitive(False) | ||
else: | ||
self.builder.get_object("btnPrev").set_sensitive(True) | ||
if args[2] == pages - 1: | ||
self.builder.get_object("btnNext").set_sensitive(False) | ||
else: | ||
self.builder.get_object("btnNext").set_sensitive(True) | ||
|
||
def on_btnGlade_clicked(self, *args): | ||
subprocess.call(["glade", "gui.glade"]) | ||
|
||
if __name__ == "__main__": | ||
builder = Gtk.Builder() | ||
builder.add_from_file("./gui.glade") | ||
builder.connect_signals(Handler(builder)) | ||
|
||
screen = Gdk.Screen.get_default() | ||
provider = Gtk.CssProvider() | ||
provider.load_from_path("./style.css") | ||
Gtk.StyleContext.add_provider_for_screen( | ||
screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) | ||
|
||
window = builder.get_object("winApp") | ||
window.show_all() | ||
|
||
Gtk.main() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
* { | ||
font-size: 16px; | ||
} | ||
|
||
.styBold { | ||
font-weight: bold; | ||
} | ||
|
||
.styTitle { | ||
font-size: 28px; | ||
font-weight: bold; | ||
} | ||
|
||
.styStart { | ||
font-size: 24px; | ||
font-weight: bold; | ||
color: white; | ||
background-color: forestgreen; | ||
} | ||
|
||
.styIntro { | ||
font-size: 24px; | ||
font-weight: bold; | ||
} | ||
|
||
.styMono { | ||
font-family: Monospace; | ||
color: teal; | ||
} | ||
|
||
.styTry { | ||
font-size: 28px; | ||
font-weight: bold; | ||
color: indianred; | ||
} | ||
|
||
.styCSS0 * { | ||
background-color: peru; | ||
padding: 5px; | ||
} | ||
|
||
.styCSS1 { | ||
font-family: Purisa; | ||
color: skyblue; | ||
padding: 10px; | ||
font-weight: bold; | ||
font-style: italic; | ||
} | ||
|
||
.styCSS2 { | ||
font-family: eufm10; | ||
font-size: 64px; | ||
font-stretch: ultra-condensed; | ||
letter-spacing: -10px; | ||
text-shadow: 5px 5px violet; | ||
border: 2px dashed green; | ||
} |