Récupération des valeurs saisies dans l'IHM
authorSébastien CHAZALLET <s.chazallet@gmail.com>
Fri, 14 Jun 2013 08:07:08 +0000 (10:07 +0200)
committerSébastien CHAZALLET <s.chazallet@gmail.com>
Fri, 14 Jun 2013 08:07:08 +0000 (10:07 +0200)
test/OpenERPEasyStarter.glade
test/test.py

index 8348420..9c10f15 100644 (file)
@@ -92,9 +92,11 @@ post install</property>
                 <child>
                   <object class="GtkRadioButton" id="radio_start">
                     <property name="label" translatable="yes">Démarrer</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
@@ -108,9 +110,11 @@ post install</property>
                 <child>
                   <object class="GtkRadioButton" id="radio_maj">
                     <property name="label" translatable="yes">Mettre à jour</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
@@ -125,9 +129,11 @@ post install</property>
                 <child>
                   <object class="GtkRadioButton" id="radio_reinstall">
                     <property name="label" translatable="yes">Réinstaller</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
@@ -233,6 +239,7 @@ post install</property>
         <child>
           <object class="GtkButton" id="button">
             <property name="label" translatable="yes">Démarrer</property>
+            <property name="use_action_appearance">False</property>
             <property name="height_request">35</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -240,7 +247,8 @@ post install</property>
             <property name="has_tooltip">True</property>
             <property name="tooltip_text" translatable="yes">Démarrer OpenERP</property>
             <property name="margin_top">5</property>
-            <signal name="clicked" handler="on_start_button_clicked" swapped="no"/>
+            <property name="use_action_appearance">False</property>
+            <signal name="clicked" handler="on_start_button_clicked" object="main_window" swapped="no"/>
           </object>
           <packing>
             <property name="expand">False</property>
index 9195661..60c5805 100644 (file)
@@ -1,4 +1,6 @@
 #!/usr/bin/python3
+#-*- coding: utf-8 -*-
+
 
 from gi.repository import Gtk
 
@@ -25,8 +27,39 @@ class TestMainWindow:
         self.window = GladeWindowManager.initWindow("main_window", self)
         self.window.show_all()
 
+    @staticmethod
+    def _get_all_textlines_from_buffer(buffer):
+        start, end = buffer.get_start_iter(), buffer.get_end_iter()
+        return buffer.get_text(start, end, True).splitlines()
+
     def on_start_button_clicked(self, widget, data=None):
-        print("Bravo")
+        # Récupération des widgets utiles à partir du widget général
+        grid = widget.get_children()[0].get_children()[1]
+        widgets = [e.get_children() for e in grid.get_children()
+                                    if type(e) != Gtk.Label]
+        # Récupération des valeurs dans "Scripts"
+        scripts = self._get_all_textlines_from_buffer(
+            widgets[0][0].get_buffer()
+        )
+        # Récupération des valeurs dans "Bases"
+        bases = self._get_all_textlines_from_buffer(
+            widgets[1][0].get_buffer()
+        )
+        # Récupération des valeurs dans "Modules"
+        modules = self._get_all_textlines_from_buffer(
+            widgets[2][0].get_buffer()
+        )
+        # Récupération de la valeur dans "Actions"
+        action = [rb.get_label() for rb in widgets[3] if rb.get_active()][0]
+        print("""Éléments récupérés :
+modules :
+%s
+bases
+%s
+scripts
+%s
+action
+%s""" % (modules, bases, scripts, action))
 
 
 if __name__ == "__main__":