Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brunnme committed Sep 28, 2020
0 parents commit 9ab2356
Show file tree
Hide file tree
Showing 8 changed files with 1,381 additions and 0 deletions.
Binary file added glade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gtk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,200 changes: 1,200 additions & 0 deletions gui.glade

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions helloglade.py
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()
32 changes: 32 additions & 0 deletions helloworld.py
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()
66 changes: 66 additions & 0 deletions main.py
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()
Binary file added python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions style.css
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;
}

0 comments on commit 9ab2356

Please sign in to comment.