Skip to content

Commit 65a421c

Browse files
author
Mirko Brombin
committed
Documenting the main file
1 parent ebb05aa commit 65a421c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

elementarypython/main.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@
2121
import gi
2222

2323
gi.require_version('Gtk', '3.0')
24-
gi.require_version('Granite', '1.0')
2524

26-
from gi.repository import Gtk, Gio, Gdk, Granite
25+
from gi.repository import Gtk, Gio, Gdk
2726

2827
import window as wn
2928
import constants as cn
29+
3030
class Application(Gtk.Application):
3131

3232
def do_activate(self):
33+
'''Here we are creating a new instante of the Windows, setting its
34+
size and connecting the delete-event signal to correctly handle
35+
the application exit.'''
3336
self.win = wn.Window()
3437
self.win.set_default_size(600, 600)
3538
self.win.connect("delete-event", Gtk.main_quit)
@@ -41,19 +44,23 @@ def do_activate(self):
4144

4245
app = Application()
4346

47+
'''Here we are defining the application colors, using the parameters
48+
defined in the constants file.'''
4449
stylesheet = f"""
4550
@define-color colorPrimary {cn.Colors.primary_color};
4651
@define-color textColorPrimary {cn.Colors.primary_text_color};
4752
@define-color textColorPrimaryShadow {cn.Colors.primary_text_shadow_color};
4853
"""
4954

55+
'''And here we are injecting the style CSS in the application'''
5056
style_provider = Gtk.CssProvider()
5157
style_provider.load_from_data(bytes(stylesheet.encode()))
5258
Gtk.StyleContext.add_provider_for_screen(
5359
Gdk.Screen.get_default(), style_provider,
5460
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
5561
)
5662

63+
'''Defining our application infos'''
5764
app.application_id = cn.App.application_id
5865
app.flags = Gio.ApplicationFlags.FLAGS_NONE
5966
app.program_name = cn.App.application_name
@@ -67,4 +74,5 @@ def do_activate(self):
6774
app.help_url = cn.App.help_url
6875
app.translate_url = cn.App.translate_url
6976

77+
'''Let's make our app roar!'''
7078
app.run("")

0 commit comments

Comments
 (0)