Example #1
0
    def _call_option_set(self, option, value):
        self.table_model.layoutAboutToBeChanged.emit()
        hotbox = self.get_selected_hotbox()
        if option == 'name':
            value = get_valid_name(self.table_model.hotboxes, value)

        if hotbox is not None:
            hotbox['general'][option] = value
        self.table_model.layoutChanged.emit()
        self.save_hotboxes()
Example #2
0
    def _call_import(self):
        hotbox = import_hotbox()
        if not hotbox:
            pass
        hotboxes = self.table_model.hotboxes
        name = get_valid_name(hotboxes, hotbox['general']['name'])
        hotbox['general']['name'] = name

        self.table_model.layoutAboutToBeChanged.emit()
        self.table_model.hotboxes.append(hotbox)
        self.table_model.layoutChanged.emit()
        self.save_hotboxes()
Example #3
0
    def _call_import(self):
        hotbox = import_hotbox()
        if not hotbox:
            return warning('Hotbox designer', 'No hotbox selected')
        hotboxes = self.personnal_model.hotboxes
        name = get_valid_name(hotboxes, hotbox['general']['name'])
        hotbox['general']['name'] = name

        self.personnal_model.layoutAboutToBeChanged.emit()
        self.personnal_model.hotboxes.append(hotbox)
        self.personnal_model.layoutChanged.emit()
        self.save_hotboxes()
        self.toolbar.reload.setEnabled(True)
Example #4
0
 def hotbox(self):
     if self.groupbutton.checkedId() == 0:
         return get_new_hotbox(self.hotboxes)
     elif self.groupbutton.checkedId() == 1:
         name = self.existing.currentText()
         hotboxes = self.hotboxes
     elif self.groupbutton.checkedId() == 2:
         name = self.template_combo.currentText()
         hotboxes = load_templates()
     hotbox = [hb for hb in hotboxes if hb['general']['name'] == name][0]
     hotbox = copy_hotbox_data(hotbox)
     name = get_valid_name(hotboxes, hotbox['general']['name'])
     hotbox['general']['name'] = name
     return hotbox
Example #5
0
    def _call_option_set(self, option, value):
        self.personnal_model.layoutAboutToBeChanged.emit()
        hotbox = self.get_selected_hotbox()
        if option == 'name':
            value = get_valid_name(self.personnal_model.hotboxes, value)

        if hotbox is not None:
            hotbox['general'][option] = value
        self.personnal_model.layoutChanged.emit()
        # self.toolbar.reload.setEnabled(True)
        self.save_hotboxes()

        # reload hotboxes automatically after the hotbox options are modified
        self.toolbar.reloadRequested.emit()