Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

kbd widget vertical stretch

  • Loading branch information...
commit dacff18a1b4a55f984f33d4529f51c751a53fb5d 1 parent 372256b
@baverman authored
Showing with 162 additions and 112 deletions.
  1. +160 −110 typetrainer/ui/main.glade
  2. +2 −2 typetrainer/ui/main.py
View
270 typetrainer/ui/main.glade
@@ -1,8 +1,9 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window">
+ <property name="can_focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Type Trainer</property>
@@ -10,23 +11,29 @@
<property name="window_position">center</property>
<property name="default_width">800</property>
<property name="type_hint">dialog</property>
- <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" swapped="no"/>
+ <signal name="key-press-event" handler="on_key_event" swapped="no"/>
+ <signal name="delete-event" handler="on_window_delete_event" swapped="no"/>
<child>
<object class="GtkVBox" id="vbox">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkEntry" id="totype_entry">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="editable">False</property>
- <property name="invisible_char">&#x25CF;</property>
+ <property name="invisible_char"></property>
<property name="caps_lock_warning">False</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -35,36 +42,47 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- <signal name="changed" handler="on_type_entry_changed" after="yes"/>
- <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"/>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <signal name="changed" handler="on_type_entry_changed" after="yes" swapped="no"/>
+ <signal name="insert-text" handler="on_type_entry_insert_text" swapped="no"/>
+ <signal name="activate" handler="on_type_entry_activate" swapped="no"/>
+ <signal name="delete-text" handler="on_type_entry_delete_text" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="retype_lb">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="stat_lb">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -82,18 +100,126 @@
<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"/>
+ <signal name="activate" handler="on_prefs_ex_activate" after="yes" swapped="no"/>
<child>
<object class="GtkHBox" id="prefs_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">15</property>
<child>
+ <object class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_stat_bt_clicked" swapped="no"/>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="on_open_bt_clicked" swapped="no"/>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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="expand">True</property>
+ <property name="fill">True</property>
+ <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>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="on_recent_bt_clicked" swapped="no"/>
+ <child>
+ <object class="GtkArrow" id="arrow1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">down</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Tutor</property>
<property name="use_underline">True</property>
@@ -104,13 +230,15 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="tutor_cb">
<property name="visible">True</property>
- <signal name="changed" handler="on_tutor_cb_changed"/>
+ <property name="can_focus">False</property>
+ <signal name="changed" handler="on_tutor_cb_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
@@ -120,22 +248,25 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Level</property>
<property name="use_underline">True</property>
@@ -146,13 +277,15 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="level_cb">
<property name="visible">True</property>
- <signal name="changed" handler="on_level_cb_changed"/>
+ <property name="can_focus">False</property>
+ <signal name="changed" handler="on_level_cb_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
@@ -162,22 +295,25 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">L_ayout</property>
<property name="use_underline">True</property>
@@ -188,13 +324,15 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="layout_cb">
<property name="visible">True</property>
- <signal name="changed" handler="on_layout_cb_changed"/>
+ <property name="can_focus">False</property>
+ <signal name="changed" handler="on_layout_cb_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
@@ -204,112 +342,23 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</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>
- <signal name="clicked" handler="on_open_bt_clicked"/>
- <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>
- <signal name="clicked" handler="on_recent_bt_clicked"/>
- <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>
- <signal name="clicked" handler="on_stat_bt_clicked"/>
- <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="can_focus">False</property>
<property name="label" translatable="yes">_Misc</property>
<property name="use_underline">True</property>
</object>
@@ -317,6 +366,7 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
View
4 typetrainer/ui/main.py
@@ -8,7 +8,7 @@
from typetrainer.ui import idle, refresh_gui, BuilderAware, block_handler, ShortcutActivator
from typetrainer.util import join_to_file_dir
from typetrainer.tutors import available_tutors, get_filler
-from typetrainer.ui.kbd import n130_dvp_keyboard, n130_keyboard, n130_sdfv_keyboard, anti_rsi_keyboard
+from typetrainer.ui.kbd import n130_dvp_keyboard, n130_keyboard, n130_sdfv_keyboard, anti_rsi_keyboard
available_keyboards = (
(n130_keyboard, _('ASDF zones')),
@@ -37,7 +37,7 @@ 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, False)
+ self.vbox.pack_start(self.kbd_drawer, True, True)
self.vbox.reorder_child(self.kbd_drawer, 3)
self.kbd_drawer.set_size_request(-1, 280)
self.kbd_drawer.show()

3 comments on commit dacff18

@burkov

мне кажется клаву не надо растягивать. надо ее сделать фиксированного размера и центровать. ну или на крайняк растягивать только сохраняя пропорции высоты/ширины.

@baverman
Owner
@burkov

После увиденного на большом экране, стало страшно.

аналогично. еще это заметно при свертке Misc. панельки. до вызова pref_ex_activate клава успевает отрисоваться до нижнего края окна, потом при уменьшении окна становится снова нормальной.

Please sign in to comment.
Something went wrong with that request. Please try again.