示例#1
0
 def on_action_destinations_add_activate(self, action):
     """Add a new destination"""
     dialog = UIDestination(self.ui.dialog_host, self.model_destinations)
     if dialog.show(default_name='',
                    default_value='',
                    title=_('Add new destination'),
                    treeiter=None) == Gtk.ResponseType.OK:
         self.model_destinations.add_data(
             DestinationInfo(name=dialog.name, value=dialog.value))
     # Get the new destinations list, clear and store the list again
     dialog.destroy()
示例#2
0
 def on_action_destinations_add_activate(self, action):
     """Add a new destination"""
     dialog = UIDestination(self.ui.dialog_host, self.model_destinations)
     if dialog.show(default_name='',
                    default_value='',
                    title=_('Add new destination'),
                    treeiter=None) == Gtk.ResponseType.OK:
         self.model_destinations.add_data(
             DestinationInfo(name=dialog.name, value=dialog.value))
     # Get the new destinations list, clear and store the list again
     dialog.destroy()
示例#3
0
 def on_action_destinations_edit_activate(self, action):
     """Edit the selected destination"""
     selected_row = get_treeview_selected_row(self.ui.tvw_destinations)
     if selected_row:
         name = self.model_destinations.get_key(selected_row)
         value = self.model_destinations.get_value(selected_row)
         selected_iter = self.model_destinations.get_iter(name)
         dialog = UIDestination(self.ui.dialog_host,
                                self.model_destinations)
         if dialog.show(default_name=name,
                        default_value=value,
                        title=_('Edit destination'),
                        treeiter=selected_iter) == Gtk.ResponseType.OK:
             # Update values
             self.model_destinations.set_data(
                 selected_iter,
                 DestinationInfo(name=dialog.name, value=dialog.value))
         dialog.destroy()
示例#4
0
 def on_action_destinations_edit_activate(self, action):
     """Edit the selected destination"""
     selected_row = get_treeview_selected_row(self.ui.tvw_destinations)
     if selected_row:
         name = self.model_destinations.get_key(selected_row)
         value = self.model_destinations.get_value(selected_row)
         selected_iter = self.model_destinations.get_iter(name)
         dialog = UIDestination(self.ui.dialog_host,
                                self.model_destinations)
         if dialog.show(default_name=name,
                        default_value=value,
                        title=_('Edit destination'),
                        treeiter=selected_iter
                        ) == Gtk.ResponseType.OK:
             # Update values
             self.model_destinations.set_data(
                 selected_iter, DestinationInfo(name=dialog.name,
                                                value=dialog.value))
         dialog.destroy()