Example #1
0
 def next_window(self, widget, data=None):
     logging.info("Next window")
     selection = self.listView.get_selection()
     subselection = self.sublistView.get_selection()
     model, path_list = selection.get_selected()
     submodel, subpath_list = subselection.get_selected()
     if path_list != None:
         tool = model[path_list][0]
         if tool in map(lambda x: x[0].fullname, self.subas):
             for ass in self.subas:
                 logging.info("Assistant:{0}".format(ass[0].fullname))
                 if tool == ass[0].fullname:
                     if not ass[1]:
                         logging.info("All is OK, we can go to the next screen")
                         self.pathWindow.open_window(widget, data=None)
                         self.mainWin.hide()
                     else:
                         logging.info(subpath_list)
                         if subpath_list == None:
                             logging.info("No subassistant have been selected")
                             md=Gtk.MessageDialog(None,
                                                  Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                                  Gtk.MessageType.WARNING,
                                                  Gtk.ButtonsType.CLOSE,
                                                  "Select one subassistant")
                             md.run()
                             md.destroy()
                         else:
                             self.pathWindow.open_window(widget, data=None)
                             self.mainWin.hide()
Example #2
0
 def run_btn(self, widget, data=None):
     logging.info("run button")
     for btn in self.button:
         #logging.info(btn)
         logging.info("Name is:{0}{1}".format(btn.get_active(),btn.get_label()))
     self.parent.runWindow.open_window(widget, data)
     self.finalWindow.hide()
Example #3
0
    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)
        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": Gtk.main_quit,
                    "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_prevPathBtn_clicked": self.pathWindow.prev_window,
                    "on_prevFinalBtn_clicked": self.finalWindow.prev_window,
                    "on_runFinalBtn_clicked": self.finalWindow.run_btn,
                    "on_store_list_selection_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)
        k = 0
        for ass in self.subas:
            self.store.append([ass[0].fullname])
            if k == 0:
                if not ass[1]:
                    self.labelMainWindow.hide()
                    self.sublistView.hide()
                else:
                    for sub in ass[1]:
                        logging.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()
        Gtk.main()
Example #4
0
 def __init__(self, parent, finalWindow, builder):
     self.parent = parent
     self.finalWindow = finalWindow
     self.runWindow = builder.get_object("runWindow")
     self.textViewLog = builder.get_object("textViewLog")
     logging.info("This is used for creating projects etc.")
     self.textbuffer = self.textViewLog.get_buffer()
     self.textViewLog.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
Example #5
0
 def __init__(self,  parent, finalWindow, builder):
     self.parent = parent
     self.finalWindow = finalWindow
     self.runWindow = builder.get_object("runWindow")
     self.textViewLog = builder.get_object("textViewLog")
     logging.info("This is used for creating projects etc.")
     self.textbuffer = self.textViewLog.get_buffer()
     self.textViewLog.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
Example #6
0
 def run_btn(self, widget, data=None):
     logging.info("run button")
     for btn in self.button:
         #logging.info(btn)
         logging.info("Name is:{0}{1}".format(btn.get_active(),
                                              btn.get_label()))
     self.parent.runWindow.open_window(widget, data)
     self.finalWindow.hide()
Example #7
0
 def open_window(self, widget, data=None):
     logging.info("main function")
     dirname, projectname = self.parent.pathWindow.get_data()
     self.textbuffer.set_text("Dirname is: {0}/{1}".format(dirname,projectname))
     text_iter = self.textbuffer.get_end_iter()
     self.textbuffer.insert(text_iter,"Dirname2 is: {0}/{1}".format(dirname,projectname))
     text_iter = self.textbuffer.get_end_iter()
     self.textbuffer.insert(text_iter,"Dirname3 is: {0}/{1}".format(dirname,projectname))
     self.runWindow.show_all()
Example #8
0
 def open_window(self, widget, data=None):
     logging.info("main function")
     dirname, projectname = self.parent.pathWindow.get_data()
     self.textbuffer.set_text("Dirname is: {0}/{1}".format(
         dirname, projectname))
     text_iter = self.textbuffer.get_end_iter()
     self.textbuffer.insert(
         text_iter, "Dirname2 is: {0}/{1}".format(dirname, projectname))
     text_iter = self.textbuffer.get_end_iter()
     self.textbuffer.insert(
         text_iter, "Dirname3 is: {0}/{1}".format(dirname, projectname))
     self.runWindow.show_all()
Example #9
0
 def open_window(self, widget, data=None):
     logging.info("open window")
     selection = self.parent.listView.get_selection()
     subselection = self.parent.sublistView.get_selection()
     title = Gtk.Label("List of all available options:")
     title.set_alignment(0,0)
     self.boxMain.pack_start(title, False, False, 0)
     boxFinal = Gtk.Box(spacing=6)
     boxFinal.set_homogeneous(False)
     model, path_list = selection.get_selected()
     submodel, subpath_list = subselection.get_selected()
     if path_list != None:
         tool = model[path_list][0]
         if tool in map(lambda x: x[0].fullname, self.parent.subas):
             for ass in self.parent.subas:
                 if tool == ass[0].fullname:
                     vbox_left = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
                     vbox_left.set_homogeneous(False)
                     vbox_right = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
                     vbox_right.set_homogeneous(False)
                     boxFinal.pack_start(vbox_left, True, True, 0)
                     boxFinal.pack_start(vbox_right, True, True, 0)
                     if not ass[1]:
                         for sub in ass[0].args:
                             if sub.flags[1] != '--name':
                                 label = Gtk.Label()
                                 label.set_text(sub.kwargs['help'])
                                 label.set_alignment(0, 0)
                                 actBtn = Gtk.CheckButton(sub.flags[1][2:])
                                 vbox_left.pack_start(actBtn, True, True, 0)
                                 vbox_right.pack_start(label, True, True, 0)
                                 self.button.append(actBtn)
                                 if sub.flags[1] == '--eclipse':
                                     actBtn.connect("clicked", self.eclipse_toggled)
                                 elif sub.flags[1] == '--github':
                                     actBtn.connect("clicked", self.github_toggled)
                     else:
                         logging.info("final_open_window {0}".format(submodel[subpath_list][0]))
                         for sub in ass[1]:
                             logging.info("ass[1] is: {0}".format(sub[0].fullname))
                             if submodel[subpath_list][0] == sub[0].fullname:
                                 for arg in sub[0].args:
                                     logging.info(arg)
                                     if arg.flags[1] != '--name':
                                         label = Gtk.Label()
                                         label.set_text(arg.kwargs['help'])
                                         label.set_alignment(0, 0)
                                         actBtn = Gtk.CheckButton(arg.flags[1][2:])
                                         vbox_left.pack_start(actBtn, True, True, 0)
                                         vbox_right.pack_start(label, True, True, 0)
                                         self.button.append(actBtn)
                                         if arg.flags[1] == '--eclipse':
                                             actBtn.connect("clicked", self.eclipse_toggled)
                                         elif arg.flags[1] == '--github':
                                             actBtn.connect("clicked", self.github_toggled)
     self.boxMain.pack_start(boxFinal, False, False, 6)
     self.finalWindow.show_all()
Example #10
0
 def eclipse_toggled(self, widget, data=None):
     logging.info("Eclipse_clicked")
     active = widget.get_active()
     logging.info(active)
Example #11
0
 def open_window(self, widget, data=None):
     logging.info("open window")
     selection = self.parent.listView.get_selection()
     subselection = self.parent.sublistView.get_selection()
     title = Gtk.Label("List of all available options:")
     title.set_alignment(0, 0)
     self.boxMain.pack_start(title, False, False, 0)
     boxFinal = Gtk.Box(spacing=6)
     boxFinal.set_homogeneous(False)
     model, path_list = selection.get_selected()
     submodel, subpath_list = subselection.get_selected()
     if path_list != None:
         tool = model[path_list][0]
         if tool in map(lambda x: x[0].fullname, self.parent.subas):
             for ass in self.parent.subas:
                 if tool == ass[0].fullname:
                     vbox_left = Gtk.Box(
                         orientation=Gtk.Orientation.VERTICAL, spacing=6)
                     vbox_left.set_homogeneous(False)
                     vbox_right = Gtk.Box(
                         orientation=Gtk.Orientation.VERTICAL, spacing=6)
                     vbox_right.set_homogeneous(False)
                     boxFinal.pack_start(vbox_left, True, True, 0)
                     boxFinal.pack_start(vbox_right, True, True, 0)
                     if not ass[1]:
                         for sub in ass[0].args:
                             if sub.flags[1] != '--name':
                                 label = Gtk.Label()
                                 label.set_text(sub.kwargs['help'])
                                 label.set_alignment(0, 0)
                                 actBtn = Gtk.CheckButton(sub.flags[1][2:])
                                 vbox_left.pack_start(actBtn, True, True, 0)
                                 vbox_right.pack_start(label, True, True, 0)
                                 self.button.append(actBtn)
                                 if sub.flags[1] == '--eclipse':
                                     actBtn.connect("clicked",
                                                    self.eclipse_toggled)
                                 elif sub.flags[1] == '--github':
                                     actBtn.connect("clicked",
                                                    self.github_toggled)
                     else:
                         logging.info("final_open_window {0}".format(
                             submodel[subpath_list][0]))
                         for sub in ass[1]:
                             logging.info("ass[1] is: {0}".format(
                                 sub[0].fullname))
                             if submodel[subpath_list][0] == sub[
                                     0].fullname:
                                 for arg in sub[0].args:
                                     logging.info(arg)
                                     if arg.flags[1] != '--name':
                                         label = Gtk.Label()
                                         label.set_text(arg.kwargs['help'])
                                         label.set_alignment(0, 0)
                                         actBtn = Gtk.CheckButton(
                                             arg.flags[1][2:])
                                         vbox_left.pack_start(
                                             actBtn, True, True, 0)
                                         vbox_right.pack_start(
                                             label, True, True, 0)
                                         self.button.append(actBtn)
                                         if arg.flags[1] == '--eclipse':
                                             actBtn.connect(
                                                 "clicked",
                                                 self.eclipse_toggled)
                                         elif arg.flags[1] == '--github':
                                             actBtn.connect(
                                                 "clicked",
                                                 self.github_toggled)
     self.boxMain.pack_start(boxFinal, False, False, 6)
     self.finalWindow.show_all()
Example #12
0
 def github_toggled(self, widget, data=None):
     logging.info("Github clicked")
     active = widget.get_active()
     logging.info(active)
Example #13
0
 def github_toggled(self, widget, data=None):
     logging.info("Github clicked")
     active = widget.get_active()
     logging.info(active)
Example #14
0
 def eclipse_toggled(self, widget, data=None):
     logging.info("Eclipse_clicked")
     active = widget.get_active()
     logging.info(active)
Example #15
0
 def open_window(self, widget, data=None):
     logging.info("Prev window")
     self.pathWindow.show_all()
Example #16
0
 def open_window(self, widget, data=None):
     logging.info("Prev window")
     self.pathWindow.show_all()
Example #17
0
 def cancel_window(self, widget):
     logging.info("Cancel window")