コード例 #1
0
    def __init__(self):
        current_run.UI = 'gtk'
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.main_win = self.builder.get_object("mainWindow")
        self.gui_helper = gui_helper.GuiHelper(self)
        self.path_window = path_window.PathWindow(self, self.main_win,
                                                  self.builder,
                                                  self.gui_helper)
        self.run_window = run_window.RunWindow(self, self.builder,
                                               self.gui_helper)
        self.mainhandlers = {
            "on_mainWindow_delete_event": Gtk.main_quit,
            "on_browsePathBtn_clicked": self.path_window.browse_path,
            "on_nextPathBtn_clicked": self.path_window.next_window,
            "on_pathWindow_delete_event": Gtk.main_quit,
            "on_runWindow_delete_event": self.run_window.delete_event,
            "on_runWindow_destroy": self.run_window.destroy,
            "on_prevPathBtn_clicked": self.path_window.prev_window,
            "on_debugBtn_clicked": self.run_window.debug_btn_clicked,
            "on_clipboardBtn_clicked": self.run_window.clipboard_btn_clicked,
            "on_backBtn_clicked": self.run_window.back_btn_clicked,
            "on_mainBtn_clicked": self.run_window.main_btn_clicked,
        }
        self.builder.connect_signals(self.mainhandlers)
        self.label_main_window = self.builder.get_object("sublabel")
        self.label_project_name = self.builder.get_object("labelProjectName")
        self.box4 = self.builder.get_object("box4")
        self.box4.set_spacing(12)
        self.box4.set_border_width(12)
        # Creating Notebook widget.
        self.notebook = self.gui_helper.create_notebook()
        self.notebook.set_has_tooltip(True)
        self.box4.pack_start(self.notebook, True, True, 0)
        # Devassistant creator part
        self.top_assistant = TopAssistant()
        for subas in self.top_assistant.get_subassistants():
            self.notebook.append_page(
                self._create_notebook_page(subas),
                self.gui_helper.create_label(
                    subas.fullname,
                    wrap=False,
                    tooltip=self.gui_helper.get_formated_description(
                        subas.description)))
        self.notebook.show()
        self.kwargs = dict()
        self.data = dict()
        # Used for debugging
        console_handler = logging.StreamHandler(stream=sys.stdout)
        console_formatter = logging.Formatter(
            '%(asctime)s %(levelname)s - %(message)s')
        console_handler.setFormatter(console_formatter)
        console_handler.setLevel(logging.INFO)
        logger_gui.addHandler(console_handler)
        # End used for debugging

        self.main_win.show_all()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
コード例 #2
0
ファイル: main_window.py プロジェクト: sleeper/devassistant
 def __init__(self):
     current_run.UI = 'gtk'
     self.builder = Gtk.Builder()
     self.builder.add_from_file(gladefile)
     self.main_win = self.builder.get_object("mainWindow")
     self.gui_helper = gui_helper.GuiHelper(self)
     self.path_window = path_window.PathWindow(self, self.main_win, self.builder, self.gui_helper)
     self.run_window = run_window.RunWindow(self, self.builder, self.gui_helper)
     self.mainhandlers = {
             "on_mainWindow_delete_event": Gtk.main_quit,
             "on_browsePathBtn_clicked": self.path_window.browse_path,
             "on_nextPathBtn_clicked": self.path_window.next_window,
             "on_pathWindow_delete_event": Gtk.main_quit,
             "on_runWindow_delete_event": self.run_window.delete_event,
             "on_runWindow_destroy" : self.run_window.destroy,
             "on_prevPathBtn_clicked": self.path_window.prev_window,
             "on_debugBtn_clicked": self.run_window.debug_btn_clicked,
             "on_clipboardBtn_clicked": self.run_window.clipboard_btn_clicked,
             "on_backBtn_clicked": self.run_window.back_btn_clicked,
             "on_mainBtn_clicked": self.run_window.main_btn_clicked,
             "on_entryProjectName_changed": self.path_window.project_name_changed,
     }
     self.builder.connect_signals(self.mainhandlers)
     self.label_main_window = self.builder.get_object("sublabel")
     self.label_project_name = self.builder.get_object("labelProjectName")
     self.box4 = self.builder.get_object("box4")
     self.box4.set_spacing(12)
     self.box4.set_border_width(12)
     # Creating Notebook widget.
     self.notebook = self.gui_helper.create_notebook()
     self.notebook.set_has_tooltip(True)
     self.box4.pack_start(self.notebook, True, True, 0)
     # Devassistant creator part
     self.top_assistant = TopAssistant()
     for subas in self.top_assistant.get_subassistants():
         self.notebook.append_page(self._create_notebook_page(subas),
                                   self.gui_helper.create_label(
                                       subas.fullname,
                                       wrap=False,
                                       tooltip=self.gui_helper.get_formated_description(
                                           subas.description)))
     self.notebook.show()
     self.kwargs = dict()
     self.data = dict()
     # Used for debugging
     console_handler = logging.StreamHandler(stream=sys.stdout)
     console_formatter = logging.Formatter('%(asctime)s %(levelname)s - %(message)s')
     console_handler.setFormatter(console_formatter)
     console_handler.setLevel(logging.INFO)
     logger_gui.addHandler(console_handler)
     # End used for debugging
     self.data = dict()
     self.main_win.show_all()
     # Thread should be defined here
     # because of timeout and threads sharing.
     GLib.threads_init()
     Gdk.threads_init()
     Gdk.threads_enter()
     Gtk.main()
     Gdk.threads_leave()
コード例 #3
0
    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.main_win = self.builder.get_object("mainWindow")
        self.gui_helper = gui_helper.GuiHelper(self)
        self.yaml_window = yaml_window.YamlWindow(self, self.main_win,
                                                  self.builder)
        #self.finalWindow = finalWindow.finalWindow(self, self.pathWindow, self.builder)
        #self.runWindow = runWindow.runWindow(self, self.finalWindow, self.builder, DevelCreatorAssistants())
        self.mainhandlers = {
            "on_cancelMainBtn_clicked": Gtk.main_quit,
            "on_mainWindow_delete_event": Gtk.main_quit,
            "on_cancelYamlBtn_clicked": Gtk.main_quit,
            "on_yamlWindow_delete_event": Gtk.main_quit,
            "on_prevYamlBtn_clicked": self.yaml_window.prev_window,
            "on_createYamlBtn_clicked": self.yaml_window.run_btn,
        }
        self.builder.connect_signals(self.mainhandlers)
        self.label_main_window = self.builder.get_object("sublabel")
        self.label_project_name = self.builder.get_object("labelProjectName")
        self.box4 = self.builder.get_object("box4")
        self.box4.set_spacing(12)
        self.box4.set_border_width(12)
        # Creating Notebook widget.
        # Devassistant creator part
        self.main, self.subas = CreatorAssistant().get_subassistant_tree()
        scrolled_window = self._create_notebook_page(self.subas, 'Creator')
        self.box4.pack_start(scrolled_window, True, True, 0)

        self.kwargs = {}
        # Used for debugging
        console_handler = logging.StreamHandler(stream=sys.stdout)
        console_formatter = logging.Formatter(
            '%(asctime)s %(levelname)s - %(message)s')
        console_handler.setFormatter(console_formatter)
        console_handler.setLevel(logging.INFO)
        logger_gui.addHandler(console_handler)
        # End used for debugging

        self.main_win.show_all()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
コード例 #4
0
    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.main_win = self.builder.get_object("mainWindow")
        self.gui_helper = gui_helper.GuiHelper(self)
        self.yaml_window = yaml_window.YamlWindow(self, self.main_win, self.builder)
        #self.finalWindow = finalWindow.finalWindow(self, self.pathWindow, self.builder)
        #self.runWindow = runWindow.runWindow(self, self.finalWindow, self.builder, DevelCreatorAssistants())
        self.mainhandlers = {
                "on_cancelMainBtn_clicked": Gtk.main_quit,
                "on_mainWindow_delete_event": Gtk.main_quit,
                "on_cancelYamlBtn_clicked": Gtk.main_quit,
                "on_yamlWindow_delete_event": Gtk.main_quit,
                "on_prevYamlBtn_clicked": self.yaml_window.prev_window,
                "on_createYamlBtn_clicked": self.yaml_window.run_btn,
                    }
        self.builder.connect_signals(self.mainhandlers)
        self.label_main_window = self.builder.get_object("sublabel")
        self.label_project_name = self.builder.get_object("labelProjectName")
        self.box4 = self.builder.get_object("box4")
        self.box4.set_spacing(12)
        self.box4.set_border_width(12)
        # Creating Notebook widget.
        # Devassistant creator part
        self.main, self.subas = CreatorAssistant().get_subassistant_tree()
        scrolled_window = self._create_notebook_page(self.subas, 'Creator')
        self.box4.pack_start(scrolled_window, True, True, 0)

        self.kwargs = {}
        # Used for debugging
        console_handler = logging.StreamHandler(stream=sys.stdout)
        console_formatter = logging.Formatter('%(asctime)s %(levelname)s - %(message)s')
        console_handler.setFormatter(console_formatter)
        console_handler.setLevel(logging.INFO)
        logger_gui.addHandler(console_handler)
        # End used for debugging

        self.main_win.show_all()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
コード例 #5
0
ファイル: main_window.py プロジェクト: sYnfo/devassistant
    def __init__(self):
        command_helpers.DialogHelper.use_helper = 'gtk'
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.main_win = self.builder.get_object("mainWindow")
        self.gui_helper = gui_helper.GuiHelper(self)
        self.path_window = path_window.PathWindow(self, self.main_win, self.builder, self.gui_helper)
        self.run_window = run_window.RunWindow(self, self.builder, self.gui_helper)
        self.mainhandlers = {
                "on_cancelMainBtn_clicked": Gtk.main_quit,
                "on_mainWindow_delete_event": Gtk.main_quit,
                "on_browsePathBtn_clicked": self.path_window.browse_path,
                "on_cancelPathBtn_clicked": Gtk.main_quit,
                "on_cancelFinalBtn_clicked": Gtk.main_quit,
                "on_cancelRunBtn_clicked": self.run_window.close_btn,
                "on_nextPathBtn_clicked": self.path_window.next_window,
                "on_pathWindow_delete_event": Gtk.main_quit,
                "on_runWindow_delete_event": self.run_window.close_btn,
                "on_prevPathBtn_clicked": self.path_window.prev_window,
                "on_debugBtn_clicked": self.run_window.debug_btn_clicked,
                "on_clipboardBtn_clicked": self.run_window.clipboard_btn_clicked,
                "on_backBtn_clicked": self.run_window.back_btn_clicked,
                    }
        self.builder.connect_signals(self.mainhandlers)
        self.label_main_window = self.builder.get_object("sublabel")
        self.label_project_name = self.builder.get_object("labelProjectName")
        self.box4 = self.builder.get_object("box4")
        self.box4.set_spacing(12)
        self.box4.set_border_width(12)
        # Creating Notebook widget.
        self.notebook = self.gui_helper.create_notebook()
        self.notebook.set_has_tooltip(True)
        self.box4.pack_start(self.notebook, True, True, 0)
        # Devassistant creator part
        self.main, self.subas_creator = CreatorAssistant().get_subassistant_tree()
        self.notebook.append_page(self._create_notebook_page(self.subas_creator, 'Creator'),
                                  self.gui_helper.create_label(
                                  CreatorAssistant.fullname,
                                  wrap=False,
                                  tooltip=self.gui_helper.get_formated_description(self.main.description)))
        # Devassistant modifier part
        self.main, self.subas_modifier = ModifierAssistant().get_subassistant_tree()
        self.notebook.append_page(self._create_notebook_page(self.subas_modifier, 'Modifier'),
                                  self.gui_helper.create_label(
                                  ModifierAssistant.fullname,
                                  wrap=False,
                                  tooltip=self.gui_helper.get_formated_description(self.main.description)))
        # Devassistant preparer part
        self.main, self.subas_preparer = PreparerAssistant().get_subassistant_tree()
        self.notebook.append_page(self._create_notebook_page(self.subas_preparer, 'Preparer'),
                                  self.gui_helper.create_label(
                                  PreparerAssistant.fullname,
                                  wrap=False,
                                  tooltip=self.gui_helper.get_formated_description(self.main.description)))

        self.notebook.show()
        self.kwargs = dict()
        self.data = dict()
        # Used for debugging
        console_handler = logging.StreamHandler(stream=sys.stdout)
        console_formatter = logging.Formatter('%(asctime)s %(levelname)s - %(message)s')
        console_handler.setFormatter(console_formatter)
        console_handler.setLevel(logging.INFO)
        logger_gui.addHandler(console_handler)
        # End used for debugging

        self.main_win.show_all()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
コード例 #6
0
ファイル: mainWindow.py プロジェクト: aoighost/devassistant
    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.mainWin = self.builder.get_object("mainWindow")
        self.pathWindow = pathWindow.pathWindow(self, self.mainWin, self.builder)
        self.finalWindow = finalWindow.finalWindow(self, self.pathWindow, self.builder)
        self.runWindow = runWindow.runWindow(self, self.finalWindow, self.builder, DevelAssistants())
        self.mainhandlers = {
                "on_nextMainBtn_clicked": self.next_window,
                "on_cancelMainBtn_clicked": Gtk.main_quit,
                "on_mainWindow_delete_event": Gtk.main_quit,
                "on_browsePathBtn_clicked": self.pathWindow.browse_path,
                "on_cancelPathBtn_clicked": Gtk.main_quit,
                "on_cancelFinalBtn_clicked": Gtk.main_quit,
                "on_cancelRunBtn_clicked": self.runWindow.close_btn,
                "on_nextPathBtn_clicked": self.pathWindow.next_window,
                "on_pathWindow_delete_event": Gtk.main_quit,
                "on_finalWindow_delete_event": Gtk.main_quit,
                "on_runWindow_delete_event": Gtk.main_quit,
                "on_textViewLog_visibility_notify_event" : self.runWindow.visibility_event,
                "on_prevPathBtn_clicked": self.pathWindow.prev_window,
                "on_prevFinalBtn_clicked": self.finalWindow.prev_window,
                "on_runFinalBtn_clicked": self.finalWindow.run_btn,
                "on_store_view_cursor_changed": self.store_view_cursor_changed,
                    }
        self.builder.connect_signals(self.mainhandlers)
        self.listView = self.builder.get_object("storeView")
        self.labelMainWindow = self.builder.get_object("sublabel")
        self.sublistView = self.builder.get_object("subStoreView")
        self.substoreList = self.builder.get_object("substoreList")
        self.labelProjectName = self.builder.get_object("labelProjectName")
        self.main, self.subas = DevelAssistants().get_subassistant_chain()
        self.store = Gtk.ListStore(str)
        self.substore = Gtk.ListStore(str)
        self.kwargs = {}
        # Used for debugging
        console_handler = logging.StreamHandler(stream=sys.stdout)
        console_formatter = logging.Formatter('%(asctime)s %(levelname)s - %(message)s')
        console_handler.setFormatter(console_formatter)
        console_handler.setLevel(logging.INFO)
        logger_gui.addHandler(console_handler)
        # End used for debugging
        k = 0
        for ass in sorted(self.subas, key=lambda x: x[0].fullname):
            self.store.append([ass[0].fullname])
            if k == 0:
                if not ass[1]:
                    self.labelMainWindow.hide()
                    self.sublistView.hide()
                else:
                    for sub in sorted(ass[1], key=lambda y: y[0].fullname):
                        logger_gui.info("subas:%s and %s" % (sub[0].name, sub[0].fullname))
                        self.substore.append([sub[0].fullname])
                        self.labelMainWindow.show()
                        self.sublistView.show()
                k += 1

        self.listView.set_model(self.store)
        self.sublistView.set_model(self.substore)

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("List of languages", renderer, text=0)
        self.listView.append_column(column)
        subrenderer = Gtk.CellRendererText()
        subcolumn = Gtk.TreeViewColumn("List of languages", subrenderer, text=0)
        self.sublistView.append_column(subcolumn)
        self.mainWin.show_all()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()