+++ /dev/null
-#!/usr/bin/python3
-#-*- coding: utf-8 -*-
-
-
-from gi.repository import Gtk
-
-
-class GladeWindowManager:
- builder = Gtk.Builder()
-
- @classmethod
- def append(cls, glade_file):
- cls.builder.add_from_file(glade_file)
-
- @classmethod
- def initWindow(cls, window_name, window_instance):
- cls.builder.connect_signals(window_instance)
- return cls.builder.get_object(window_name)
-
-
-class TestMainWindow:
-
- def on_window_destroy(self, widget, data=None):
- Gtk.main_quit()
-
- def __init__(self):
- 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):
- # 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__":
- GladeWindowManager.append("OpenERPEasyStarter.glade")
- appli = TestMainWindow()
- Gtk.main()
\ No newline at end of file