Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalther Neuper <neuper@neuper.(none)>2009-12-14 12:21:43 (GMT)
committer Walther Neuper <neuper@neuper.(none)>2009-12-14 12:21:43 (GMT)
commit0e303c572fc6e61cc60c82362f79d6256faada45 (patch)
treea81fd5f499637b59e0ab64a934be5bb6e76c4016
parenta2152dd5868abdfb4e54205a40d6bd341c960d66 (diff)
2nd review display, establish coding standards
-rwxr-xr-xReckonPrimer.activity/display.py51
1 files changed, 12 insertions, 39 deletions
diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py
index 45abf05..644fc58 100755
--- a/ReckonPrimer.activity/display.py
+++ b/ReckonPrimer.activity/display.py
@@ -37,40 +37,29 @@ class Display:
# +----------------------------------+----------------------------------+
def __init__(self, window):
+ self._permanent_gui_elements(window)
self.errors = 0
self._sett = None # setting updated by callbacks during input
self.running = False # first round of calculations
-
self.active_topic = None
+
+ def _permanent_gui_elements(self, window):
+ self.main_window = window # Save the sugar main window
-
- # ----- all permanent GUI-elements ----- TODO separate def
- # Save the sugar main window
- self.main_window = window
-
- # Create a table consisting of 4 possible entries
+ # whole window with 5 lines and 2 columns
self.table = gtk.Table(5, 2, True)
-
- # Put the table in the main window
self.main_window.set_canvas(self.table)
-
- # Create the log_buffer
- self.log_buffer = gtk.TextBuffer()
- # Create a tag table from the buffer
+ self.log_buffer = gtk.TextBuffer()
self.tag_table = self.log_buffer.get_tag_table()
- # Create a tag for errors
- self.error_tag = gtk.TextTag("error")
+ self.error_tag = gtk.TextTag("error") # tag for errors
self.error_tag.set_property("foreground", "blue")
self.tag_table.add(self.error_tag)
-
- # Create a tag for correct calculations
- self.correct_tag = gtk.TextTag("correct")
+ self.correct_tag = gtk.TextTag("correct")# tag for correct calcs
self.correct_tag.set_property("foreground", "green")
self.tag_table.add(self.correct_tag)
-
# Create a log_view with the previously created log_buffer
self.log_view = gtk.TextView(self.log_buffer)
# Set the font size for the log_view
@@ -79,9 +68,7 @@ class Display:
self.log_view.set_cursor_visible(False)
self.log_view.set_justification(gtk.JUSTIFY_CENTER)
- # Create a scrollable window for the log_view
- self.scrolled_window = gtk.ScrolledWindow()
- # Set scrollable window policies
+ self.scrolled_window = gtk.ScrolledWindow() # for the log_view
self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
@@ -92,34 +79,20 @@ class Display:
self.log_view.show()
self.scrolled_window.show()
- # Settings start here
+ # 3 tables as overlays with same 15 lines and 6 columns
self.settings_table = gtk.Table(15, 6, True)
-
- # Topic table
self.topic_table = gtk.Table(15, 6, True)
-
- # Separate table for start button
self.table_with_start = gtk.Table(15, 6, True)
- # Insert the settings window into the right half of the screen
+ # Insert the 3 tables into the right half of the screen
self.table.attach(self.settings_table, 1, 2, 0, 5)
-
- # Insert the topic window into the right half of the screen
self.table.attach(self.topic_table, 1, 2, 0, 5)
-
- # Insert the table for start button into the right half of the screen
self.table.attach(self.table_with_start, 1, 2, 0, 5)
- # Display the settings_table
+ # show all tables
self.settings_table.show()
-
- # Disply the topic table
self.topic_table.show()
-
- # Display the table_with_start
self.table_with_start.show()
-
- # Display the table
self.table.show()
def register(self, sess, co, learner):