From a18a61f4979435d34357c8dd7a8164aee7274291 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20CHAZALLET?= Date: Fri, 14 Jun 2013 10:37:21 +0200 Subject: [PATCH] =?utf8?q?Renommage=20du=20r=C3=A9pertoire?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- oestarter/.gitignore | 22 +++ oestarter/OpenERPEasyStarter.glade | 263 ++++++++++++++++++++++++++++++++++++ oestarter/__init__.py | 12 ++ oestarter/ihm.py | 84 ++++++++++++ oestarter/manager.py | 14 ++ test/.gitignore | 22 --- test/OpenERPEasyStarter.glade | 263 ------------------------------------ test/__init__.py | 12 -- test/ihm.py | 84 ------------ test/manager.py | 14 -- 10 files changed, 395 insertions(+), 395 deletions(-) create mode 100644 oestarter/.gitignore create mode 100644 oestarter/OpenERPEasyStarter.glade create mode 100644 oestarter/__init__.py create mode 100644 oestarter/ihm.py create mode 100644 oestarter/manager.py delete mode 100644 test/.gitignore delete mode 100644 test/OpenERPEasyStarter.glade delete mode 100644 test/__init__.py delete mode 100644 test/ihm.py delete mode 100644 test/manager.py diff --git a/oestarter/.gitignore b/oestarter/.gitignore new file mode 100644 index 0000000..6eaafca --- /dev/null +++ b/oestarter/.gitignore @@ -0,0 +1,22 @@ +*.py[cod] +*.so +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 +__pycache__ +pip-log.txt +.coverage +.tox +nosetests.xml +.project +.pydevproject diff --git a/oestarter/OpenERPEasyStarter.glade b/oestarter/OpenERPEasyStarter.glade new file mode 100644 index 0000000..9c10f15 --- /dev/null +++ b/oestarter/OpenERPEasyStarter.glade @@ -0,0 +1,263 @@ + + + + + 435 + False + 5 + 5 + 5 + 5 + + + + True + False + vertical + 6 + + + True + False + 7 + OpenERP Easy Starter + + + + + + False + True + 0 + + + + + True + False + 10 + 5 + True + + + True + False + 0 + 0.20000000298023224 + Bases + + + 0 + 1 + 1 + 1 + + + + + True + False + 0 + 0.20000000298023224 + Actions + + + 0 + 2 + 1 + 1 + + + + + True + False + 0 + 0.20000000298023224 + Scripts +post install + + + 0 + 3 + 1 + 1 + + + + + True + False + vertical + + + Démarrer + False + True + True + False + False + 0 + True + True + + + False + True + 0 + + + + + Mettre à jour + False + True + True + False + False + 0 + True + True + radio_start + + + False + True + 1 + + + + + Réinstaller + False + True + True + False + False + 0 + True + True + radio_start + + + False + True + 2 + + + + + 1 + 2 + 1 + 1 + + + + + True + True + True + in + + + True + True + + + + + 1 + 0 + 1 + 1 + + + + + 0 + True + True + in + + + True + True + + + + + 1 + 1 + 1 + 1 + + + + + 0 + True + True + in + + + True + True + + + + + 1 + 3 + 1 + 1 + + + + + 92 + True + False + 0 + 0.20000000298023224 + Modules + + + 0 + 0 + 1 + 1 + + + + + False + True + 1 + + + + + Démarrer + False + 35 + True + True + True + True + Démarrer OpenERP + 5 + False + + + + False + False + end + 2 + + + + + + diff --git a/oestarter/__init__.py b/oestarter/__init__.py new file mode 100644 index 0000000..9d16732 --- /dev/null +++ b/oestarter/__init__.py @@ -0,0 +1,12 @@ +from ihm import GladeWindowManager +from ihm import MainWindow + +from manager import test_action_on_start_button + +GladeWindowManager.append("OpenERPEasyStarter.glade") +appli = MainWindow() + +if __name__ == "__main__": + # Test de l'application. + appli.set_action_on_start_button(test_action_on_start_button) + appli.start() diff --git a/oestarter/ihm.py b/oestarter/ihm.py new file mode 100644 index 0000000..30b5684 --- /dev/null +++ b/oestarter/ihm.py @@ -0,0 +1,84 @@ +#!/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 MainWindow: + + @staticmethod + def start(): + Gtk.main() + + 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() + + def set_action_on_start_button(self, action): + self.action_on_start_button = action + + @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] + + # Appel de l'action à réaliser lorsque l'on clique sur le bouton + self.action_on_start_button(action, modules, bases, scripts) + +if __name__ == "__main__": + GladeWindowManager.append("OpenERPEasyStarter.glade") + appli = MainWindow() + + # Définition d'une action de test + def test_action_on_start_button(action, modules, bases, scripts): + print("""Éléments récupérés : +modules : +%s +bases +%s +scripts +%s +action +%s""" % (modules, bases, scripts, action)) + + # Connection de l'action à l'IHM + appli.set_action_on_start_button(test_action_on_start_button) + # Lancement de l'IHM + appli.start() diff --git a/oestarter/manager.py b/oestarter/manager.py new file mode 100644 index 0000000..be7a746 --- /dev/null +++ b/oestarter/manager.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 +#-*- coding: utf-8 -*- + + +def test_action_on_start_button(action, modules, bases, scripts): + print("""Éléments récupérés : +modules : +%s +bases +%s +scripts +%s +action +%s""" % (modules, bases, scripts, action)) diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 6eaafca..0000000 --- a/test/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.py[cod] -*.so -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 -__pycache__ -pip-log.txt -.coverage -.tox -nosetests.xml -.project -.pydevproject diff --git a/test/OpenERPEasyStarter.glade b/test/OpenERPEasyStarter.glade deleted file mode 100644 index 9c10f15..0000000 --- a/test/OpenERPEasyStarter.glade +++ /dev/null @@ -1,263 +0,0 @@ - - - - - 435 - False - 5 - 5 - 5 - 5 - - - - True - False - vertical - 6 - - - True - False - 7 - OpenERP Easy Starter - - - - - - False - True - 0 - - - - - True - False - 10 - 5 - True - - - True - False - 0 - 0.20000000298023224 - Bases - - - 0 - 1 - 1 - 1 - - - - - True - False - 0 - 0.20000000298023224 - Actions - - - 0 - 2 - 1 - 1 - - - - - True - False - 0 - 0.20000000298023224 - Scripts -post install - - - 0 - 3 - 1 - 1 - - - - - True - False - vertical - - - Démarrer - False - True - True - False - False - 0 - True - True - - - False - True - 0 - - - - - Mettre à jour - False - True - True - False - False - 0 - True - True - radio_start - - - False - True - 1 - - - - - Réinstaller - False - True - True - False - False - 0 - True - True - radio_start - - - False - True - 2 - - - - - 1 - 2 - 1 - 1 - - - - - True - True - True - in - - - True - True - - - - - 1 - 0 - 1 - 1 - - - - - 0 - True - True - in - - - True - True - - - - - 1 - 1 - 1 - 1 - - - - - 0 - True - True - in - - - True - True - - - - - 1 - 3 - 1 - 1 - - - - - 92 - True - False - 0 - 0.20000000298023224 - Modules - - - 0 - 0 - 1 - 1 - - - - - False - True - 1 - - - - - Démarrer - False - 35 - True - True - True - True - Démarrer OpenERP - 5 - False - - - - False - False - end - 2 - - - - - - diff --git a/test/__init__.py b/test/__init__.py deleted file mode 100644 index 9d16732..0000000 --- a/test/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -from ihm import GladeWindowManager -from ihm import MainWindow - -from manager import test_action_on_start_button - -GladeWindowManager.append("OpenERPEasyStarter.glade") -appli = MainWindow() - -if __name__ == "__main__": - # Test de l'application. - appli.set_action_on_start_button(test_action_on_start_button) - appli.start() diff --git a/test/ihm.py b/test/ihm.py deleted file mode 100644 index 30b5684..0000000 --- a/test/ihm.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/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 MainWindow: - - @staticmethod - def start(): - Gtk.main() - - 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() - - def set_action_on_start_button(self, action): - self.action_on_start_button = action - - @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] - - # Appel de l'action à réaliser lorsque l'on clique sur le bouton - self.action_on_start_button(action, modules, bases, scripts) - -if __name__ == "__main__": - GladeWindowManager.append("OpenERPEasyStarter.glade") - appli = MainWindow() - - # Définition d'une action de test - def test_action_on_start_button(action, modules, bases, scripts): - print("""Éléments récupérés : -modules : -%s -bases -%s -scripts -%s -action -%s""" % (modules, bases, scripts, action)) - - # Connection de l'action à l'IHM - appli.set_action_on_start_button(test_action_on_start_button) - # Lancement de l'IHM - appli.start() diff --git a/test/manager.py b/test/manager.py deleted file mode 100644 index be7a746..0000000 --- a/test/manager.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/python3 -#-*- coding: utf-8 -*- - - -def test_action_on_start_button(action, modules, bases, scripts): - print("""Éléments récupérés : -modules : -%s -bases -%s -scripts -%s -action -%s""" % (modules, bases, scripts, action)) -- 1.7.10.4