Commit 52a4fac

mo khan <mo@mokhan.ca>
2014-01-31 03:46:57
display leo and a right/wrong button.
1 parent 0d6a2d2
lib/presentation/presenters/application_shell_presenter.rb
@@ -8,6 +8,7 @@ class ApplicationShellPresenter
     @view.set_title("Hello World")
     @view.bind_to(self)
     Build.menu_bar.with(File.menu(@event_aggregator)).add_to(@view)
+    @view.display("leonardo.jpg")
     @view.show_all
   end
 
lib/presentation/windows/application_shell.rb
@@ -11,5 +11,29 @@ class ApplicationShell < Window
     self.on(:destroy) do
       presenter.shutdown
     end
+
+    table = Gtk::Table.new(8, 4, false)
+    halign = Gtk::Alignment.new(0, 0, 0, 0)
+    table.attach(halign, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 0, 0)
+
+    @frame = Gtk::Frame.new
+    table.attach(@frame, 0, 2, 1, 3, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 1, 1)
+
+    right_button = Gtk::Button.new "Right"
+    right_button.set_size_request(50, 30)
+    table.attach(right_button, 3, 4, 1, 2, Gtk::FILL, Gtk::SHRINK, 1, 1)
+
+    valign = Gtk::Alignment.new 0, 0, 0, 0
+    wrong_button = Gtk::Button.new "Wrong"
+    wrong_button.set_size_request 70, 30
+    valign.add(wrong_button)
+    table.set_row_spacing(1, 3)
+    table.attach(valign, 3, 4, 2, 3, Gtk::FILL, Gtk::FILL | Gtk::EXPAND, 1, 1)
+    add(table)
+  end
+
+  def display(image)
+    path = File.expand_path(image, File.dirname(__FILE__))
+    @frame.add(Gtk::Image.new(path))
   end
 end
lib/presentation/windows/layout.glade
@@ -5,17 +5,73 @@
   <object class="GtkWindow" id="window1">
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkVBox" id="vbox1">
+      <object class="GtkHBox" id="hbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="spacing">1</property>
         <child>
-          <placeholder/>
+          <object class="GtkLabel" id="first_number">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">label</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkLabel" id="operation_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">label</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkLabel" id="second_numbers">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">label</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">=</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <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>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">4</property>
+          </packing>
         </child>
       </object>
     </child>
lib/presentation/windows/leonardo.jpg
Binary file