Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

misc panel

  • Loading branch information...
commit 89d3d81610d44d9e0d753aeb93c1ca53e91eca3c 1 parent 0a4b3c3
@baverman authored
Showing with 269 additions and 5 deletions.
  1. +258 −2 typetrainer/ui/main.glade
  2. +11 −3 typetrainer/ui/main.py
View
260 typetrainer/ui/main.glade
@@ -11,9 +11,9 @@
<property name="default_width">800</property>
<property name="type_hint">dialog</property>
<signal name="button_press_event" handler="on_window_button_press_event"/>
+ <signal name="key_release_event" handler="on_key_event"/>
<signal name="key_press_event" handler="on_key_event"/>
<signal name="delete_event" handler="on_window_delete_event"/>
- <signal name="key_release_event" handler="on_key_event"/>
<child>
<object class="GtkVBox" id="vbox">
<property name="visible">True</property>
@@ -38,9 +38,9 @@
<property name="has_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="on_type_entry_changed" after="yes"/>
- <signal name="delete_text" handler="on_type_entry_delete_text"/>
<signal name="insert_text" handler="on_type_entry_insert_text"/>
<signal name="activate" handler="on_type_entry_activate"/>
+ <signal name="delete_text" handler="on_type_entry_delete_text"/>
</object>
<packing>
<property name="expand">False</property>
@@ -79,7 +79,263 @@
<child>
<placeholder/>
</child>
+ <child>
+ <object class="GtkExpander" id="prefs_ex">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <signal name="activate" handler="on_prefs_ex_activate" after="yes"/>
+ <child>
+ <object class="GtkHBox" id="prefs_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">15</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tutor</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="tutor_cb">
+ <property name="visible">True</property>
+ <property name="model">tutor_ls</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Level</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="level_cb">
+ <property name="visible">True</property>
+ <property name="model">level_ls</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Layout</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="layout_cb">
+ <property name="visible">True</property>
+ <property name="model">layout_ls</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="open_bt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xpad">10</property>
+ <property name="label" translatable="yes">_Open</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="recent_bt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkArrow" id="arrow1">
+ <property name="visible">True</property>
+ <property name="arrow_type">down</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="stat_bt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xpad">10</property>
+ <property name="label" translatable="yes">_Statistic</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Misc</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</child>
</object>
+ <object class="GtkListStore" id="tutor_ls">
+ <columns>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="level_ls">
+ <columns>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="layout_ls">
+ <columns>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
</interface>
View
14 typetrainer/ui/main.py
@@ -1,7 +1,7 @@
import time
from collections import defaultdict, deque
-import gtk
+import gtk, glib
import pango
from typetrainer.i18n import _
@@ -36,7 +36,8 @@ def __init__(self, config, filler, stat, kbd_drawer):
self.typed_chars = deque([], CHARS_HISTORY_LENGTH)
self.errors = defaultdict(float)
- self.vbox.pack_start(self.kbd_drawer)
+ self.vbox.pack_start(self.kbd_drawer, False)
+ self.vbox.reorder_child(self.kbd_drawer, 3)
self.kbd_drawer.set_size_request(-1, 280)
self.kbd_drawer.show()
@@ -328,4 +329,11 @@ def on_stat_activate(self, item):
tutor = 'en.basic'
window = StatWindow(self.window, self.stat, tutor)
- window.window.show_all()
+ window.window.show_all()
+
+ def on_prefs_ex_activate(self, expander):
+ def resize():
+ self.window.resize(self.window.get_size()[0], self.window.size_request()[1])
+ return False
+
+ glib.timeout_add(100, resize)
Please sign in to comment.
Something went wrong with that request. Please try again.