Example #1
0
    def delete_section(self):
        if self._old_select.is_voidplace():

            log.debug('Key press event on NotebookEditable \
                      -- unload voidplace')
            #self._old_select.unload_voidplace()
            #label_tmp =self.get_tab_label(self.get_nth_page(
                #self.get_current_page()))
            #num = self.sections_widgets[label_tmp]
            #del self.sections_widgets[label_tmp]
            #for i in range(num, len(self.sections_widgets)):
                #print i
                #widget_tmp = self.sections_widgets_list[i+1]
                #self.sections_widgets[widget_tmp] = self.sections_widgets[widget_tmp] - 1 

            #self.sections_widgets_list.pop(num)
            #self.remove_page(self.get_current_page())
            num = self.get_current_page()
            cmd = CommandPageNotebook(self,
                                      self.get_nth_page(num),num, 
                                      self._profilecore,
                                      False)
            command_manager.add_command(cmd)

            self._old_select=None
        else: 
            log.debug('Key press event on NotebookEditable -- \
                      CommandAddRemoveLabel')
            cmd = CommandAddRemoveLabel(self._old_select, 
                                        self._old_select.get_text(), self._profilecore,False)
            command_manager.add_command(cmd)
        self.emit('need-save', 'Sections', None)
Example #2
0
 def _update_label(self, widget):
     #XXX Replace by Command
     log.debug("Update Label")
     selected = self._selected
     cmd = CommandChangeLabel(selected, self._entry_name.get_text(), 
                              self._profilecore,self._boxeditable, True)
     command_manager.add_command(cmd)
 def add(self, option):
     """
     Add a new option
     """
     cmd = CommandAddRemoveOptionMode(option, self.options, self.__model,
                                      self.optiondisplay, True)
     command_manager.add_command(cmd)
    def delete_section(self):
        if self._old_select.is_voidplace():

            log.debug('Key press event on NotebookEditable \
                      -- unload voidplace')
            #self._old_select.unload_voidplace()
            #label_tmp =self.get_tab_label(self.get_nth_page(
            #self.get_current_page()))
            #num = self.sections_widgets[label_tmp]
            #del self.sections_widgets[label_tmp]
            #for i in range(num, len(self.sections_widgets)):
            #print i
            #widget_tmp = self.sections_widgets_list[i+1]
            #self.sections_widgets[widget_tmp] = self.sections_widgets[widget_tmp] - 1

            #self.sections_widgets_list.pop(num)
            #self.remove_page(self.get_current_page())
            num = self.get_current_page()
            cmd = CommandPageNotebook(self, self.get_nth_page(num), num,
                                      self._profilecore, False)
            command_manager.add_command(cmd)

            self._old_select = None
        else:
            log.debug('Key press event on NotebookEditable -- \
                      CommandAddRemoveLabel')
            cmd = CommandAddRemoveLabel(self._old_select,
                                        self._old_select.get_text(),
                                        self._profilecore, False)
            command_manager.add_command(cmd)
        self.emit('need-save', 'Sections', None)
Example #5
0
 def _update_label(self, widget):
     #XXX Replace by Command
     log.debug("Update Label")
     selected = self._selected
     cmd = CommandChangeLabel(selected, self._entry_name.get_text(),
                              self._profilecore, self._boxeditable, True)
     command_manager.add_command(cmd)
Example #6
0
    def label_drag_data_received(self, w, context, x, y, data, info, time):

        if data and data.format == 8:
            context.finish(True, False, time)
            cmd = CommandAddRemoveLabel(self._old_select, self._old_select.get_name(), self._profilecore, True)
            command_manager.add_command(cmd)
            self.emit('need-save', 'Sections', None)
Example #7
0
    def _on_ok_press(self, widget):
        # Lists:
        list2 = self._list
        list1 = self._new_list

        cmd = CommandUpdateOptionList(self._widget, list1, list2, self._profilecore, True)
        command_manager.add_command(cmd)
        self.destroy()
Example #8
0
    def _on_ok_press(self, widget):
        # Lists:
        list2 = self._list
        list1 = self._new_list

        cmd = CommandUpdateOptionList(self._widget, list1, list2,
                                      self._profilecore, True)
        command_manager.add_command(cmd)
        self.destroy()
    def label_drag_data_received(self, w, context, x, y, data, info, time):

        if data and data.format == 8:
            context.finish(True, False, time)
            cmd = CommandAddRemoveLabel(self._old_select,
                                        self._old_select.get_name(),
                                        self._profilecore, True)
            command_manager.add_command(cmd)
            self.emit('need-save', 'Sections', None)
Example #10
0
    def move_item_up(self):
        '''
        Move selected item to up
        '''
        assert self.can_move_up()

        cmd = CommandMove(self, self._old_selected, self._coords, self._profilecore, True)
        command_manager.add_command(cmd)
        self.send_signal()
        self.send_signal_save()
Example #11
0
 def add(self, option):
     """
     Add a new option
     """
     cmd = CommandAddRemoveOptionMode(option, 
                                      self.options, 
                                      self.__model,
                                      self.optiondisplay,
                                      True)
     command_manager.add_command(cmd)
Example #12
0
 def exec_checkopt(self, name, w):
     option_name = name
     opt = self._listoptions.get_option_class(name)
     profileoption = option_to_profileoption(opt)
     profileoption.set_section(self.get_name())
     arg_type = self._listoptions.get_arg_type(name)
     widgets = self.option_builder(option_name, arg_type)
     w.set_profileoption(profileoption)
     w.set_name(name)
     cmd = CommandAddRemoveOption(w, widgets, self._profilecore, self,True)
     command_manager.add_command(cmd)
 def exec_checkopt(self, name, w):
     option_name = name
     opt = self._listoptions.get_option_class(name)
     profileoption = option_to_profileoption(opt)
     profileoption.set_section(self.get_name())
     arg_type = self._listoptions.get_arg_type(name)
     widgets = self.option_builder(option_name, arg_type)
     w.set_profileoption(profileoption)
     w.set_name(name)
     cmd = CommandAddRemoveOption(w, widgets, self._profilecore, self, True)
     command_manager.add_command(cmd)
    def move_item_up(self):
        '''
        Move selected item to up
        '''
        assert self.can_move_up()

        cmd = CommandMove(self, self._old_selected, self._coords,
                          self._profilecore, True)
        command_manager.add_command(cmd)
        self.send_signal()
        self.send_signal_save()
Example #15
0
    def _add_section(self, widget):
        '''
        Add a new section 
        '''
        new_name = self.notebook.get_new_name()
        page =  BoxEditable(new_name, self._profilecore, self._optionlist,
                            self.notebook, True)
        page.set_profile_core(self._profilecore)
        cmd = CommandPageNotebook(self.notebook,page, -1, self._profilecore, True)
        command_manager.add_command(cmd)

        page.send_signal_save()
Example #16
0
    def _add_section(self, widget):
        '''
        Add a new section 
        '''
        new_name = self.notebook.get_new_name()
        page = BoxEditable(new_name, self._profilecore, self._optionlist,
                           self.notebook, True)
        page.set_profile_core(self._profilecore)
        cmd = CommandPageNotebook(self.notebook, page, -1, self._profilecore,
                                  True)
        command_manager.add_command(cmd)

        page.send_signal_save()
    def delete_on_item(self, widget):
        if not widget.is_voidplace():
            # remove widgets like checkbuttons or others and put voidplace
            childs = widget.get_children()
            cmd = CommandAddRemoveOption(widget, childs, self._profilecore,
                                         self, False)
            widget.set_select(False)
            command_manager.add_command(cmd)
            log.debug(
                ' Remove Widgets like CheckButtons or others and put voidplace'
            )

        else:
            # remove voidplace and delete the widget from table/box
            #XXX
            cmd = CommandAddRemoveVoidplace(self, widget, self._coords, False)
            #widget.unload_voidplace()
            command_manager.add_command(cmd)
            log.debug('Remove voidplace and delete the widget from table')

        self._parent.emit('need-save', 'Sent', None)
Example #18
0
    def delete_on_item(self, widget):
        if not widget.is_voidplace(): 
            # remove widgets like checkbuttons or others and put voidplace
            childs = widget.get_children()
            cmd = CommandAddRemoveOption(widget,childs,
                                         self._profilecore,self, False)
            widget.set_select(False)
            command_manager.add_command(cmd)
            log.debug(' Remove Widgets like CheckButtons or others and put voidplace')

        else:
            # remove voidplace and delete the widget from table/box
            #XXX 
            cmd = CommandAddRemoveVoidplace(self, 
                                            widget, self._coords, False)
            #widget.unload_voidplace()
            command_manager.add_command(cmd)
            log.debug('Remove voidplace and delete the widget from table')


        self._parent.emit('need-save', 'Sent', None)
Example #19
0
 def add_voidplace(self, position):
     # Create SpecialHBox with Voidplace
     t = self.create_item()
     cmd = CommandVoidPlaceAttach(self, t, self._coords, True)
     command_manager.add_command(cmd)
     self._parent.emit('need-save', 'Sent', None)
    def delete_option(self, widget):
        """
        Delete option
        @param widget: widget from connect
        @type widget: HIGButton
        """
        name = self.name_entry.get_text()
        if name == '':
            d = HIGAlertDialog(type=gtk.MESSAGE_ERROR,
                               message_format=_('Invalid option '),
                               secondary_text='Fill fields of option')
            d.run()
            d.destroy()
        else:
            if self.optionlist.options.exists(name):
                #Verify if exists
                self.rf = RestructFiles(self.optionlist.options,
                                        self._wizardcore, self._profilecore)
                profile, wizard = self.rf.get_places(name)
                used = []
                for i in profile:
                    used.append(i)
                for i in wizard:
                    used.append(i)
                if used == []:
                    cmd = CommandAddRemoveOptionMode(
                        self.get_option(), self.optionlist.options,
                        self.optionlist.get_model(), self, False)
                    command_manager.add_command(cmd)
                    self.emit('need-save', None, None)
                else:
                    #Show Dialog Dependences etc!!!
                    dep = DependenceOption(name, self.rf, profile, wizard)
                    resp = dep.run()
                    dep.destroy()

                    if resp == gtk.RESPONSE_YES:
                        commands = []
                        for i in profile:
                            boxedit = self._profile.notebook.get_page_name(
                                i[0])
                            widget = boxedit.search_option(i[1])
                            cmd = CommandAddRemoveOption(
                                widget, boxedit, self._profilecore, boxedit,
                                False)

                            cmd2 = CommandAddRemoveVoidplace(
                                boxedit, widget, boxedit._coords, False)
                            commands.append(cmd)
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        for i in wizard:
                            boxedit = self._wizard.notebook.get_page_name(i[0])
                            widget = boxedit.search_option(i[1])
                            cmd = CommandAddRemoveOption(
                                widget, boxedit, self._wizardcore, boxedit,
                                False)

                            cmd2 = CommandAddRemoveVoidplace(
                                boxedit, widget, boxedit._coords, False)
                            commands.append(cmd)
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        cmd3 = CommandAddRemoveOptionMode(
                            self.get_option(), self.optionlist.options,
                            self.optionlist.get_model(), self, False)
                        commands.append(cmd3)
                        cmd = CommandContainer('Remove option and deps', True,
                                               commands)
                        command_manager.add_command(cmd)
                        self.emit('need-save', None, None)

                    else:
                        return

            else:
                d = HIGAlertDialog(type=gtk.MESSAGE_ERROR,
                                   message_format=_('ERROR'),
                                   secondary_text=_('Option do not exists'))
                d.run()
                d.destroy()
Example #21
0
 def exec_option_list(self, w):
     widgets = self._create_option_list( w)
     cmd = CommandAddRemoveOption(w,widgets, self._profile,self,
                                  True)
     command_manager.add_command(cmd)
 def move_left(self):
     cmd = CommandMovePage(self, 1, self._profilecore, True)
     command_manager.add_command(cmd)
     self.emit('changed', 'Sections', None)
     self.emit('need-save', 'Sections', None)
 def add_voidplace(self, position):
     # Create SpecialHBox with Voidplace
     t = self.create_item()
     cmd = CommandVoidPlaceAttach(self, t, self._coords, True)
     command_manager.add_command(cmd)
     self._parent.emit('need-save', 'Sent', None)
Example #24
0
    def delete_option(self, widget):
        """
        Delete option
        @param widget: widget from connect
        @type widget: HIGButton
        """
        name = self.name_entry.get_text()
        if name == '':
            d = HIGAlertDialog(type=gtk.MESSAGE_ERROR, 
                               message_format=_('Invalid option '), 
                               secondary_text='Fill fields of option')
            d.run()
            d.destroy()
        else:	    
            if self.optionlist.options.exists(name): 
                #Verify if exists 
                self.rf = RestructFiles(self.optionlist.options, 
                                        self._wizardcore,
                                        self._profilecore)
                profile, wizard =  self.rf.get_places(name)
                used = []
                for i in profile:
                    used.append(i)
                for i in wizard:
                    used.append(i)
                if used == []:
                    cmd = CommandAddRemoveOptionMode(self.get_option(),
                                                     self.optionlist.options,
                                                     self.optionlist.get_model(),
                                                     self,
                                                     False)
                    command_manager.add_command(cmd)
                    self.emit('need-save', None, None)
                else:
                    #Show Dialog Dependences etc!!!
                    dep = DependenceOption(name, self.rf, profile, wizard)
                    resp = dep.run()
                    dep.destroy()

                    if resp == gtk.RESPONSE_YES:
                        commands = []
                        for i in profile:
                            boxedit = self._profile.notebook.get_page_name(i[0])
                            widget = boxedit.search_option(i[1])
                            cmd = CommandAddRemoveOption(widget,
                                                         boxedit,
                                                         self._profilecore,
                                                         boxedit, 
                                                         False)

                            cmd2 = CommandAddRemoveVoidplace(boxedit,
                                                             widget,
                                                             boxedit._coords,
                                                             False)
                            commands.append(cmd)
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        for i in wizard:
                            boxedit = self._wizard.notebook.get_page_name(i[0])
                            widget = boxedit.search_option(i[1])
                            cmd = CommandAddRemoveOption(widget,
                                                         boxedit,
                                                         self._wizardcore,
                                                         boxedit,
                                                         False)

                            cmd2 = CommandAddRemoveVoidplace(boxedit,
                                                             widget,
                                                             boxedit._coords,
                                                             False)
                            commands.append(cmd)
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        cmd3 = CommandAddRemoveOptionMode(self.get_option(),
                                                          self.optionlist.options,
                                                          self.optionlist.get_model(),
                                                          self,
                                                          False)
                        commands.append(cmd3)
                        cmd = CommandContainer('Remove option and deps',
                                               True,
                                               commands)
                        command_manager.add_command(cmd)
                        self.emit('need-save', None, None)


                    else: 
                        return

            else: 
                d = HIGAlertDialog(type= gtk.MESSAGE_ERROR, 
                                   message_format=_('ERROR'),
                                   secondary_text=_('Option do not exists')
                                   )
                d.run()
                d.destroy()
Example #25
0
 def move_left(self):
     cmd = CommandMovePage(self, 1, self._profilecore, True)
     command_manager.add_command(cmd)
     self.emit('changed','Sections', None)
     self.emit('need-save', 'Sections', None)
 def exec_option_list(self, w):
     widgets = self._create_option_list(w)
     cmd = CommandAddRemoveOption(w, widgets, self._profile, self, True)
     command_manager.add_command(cmd)