Esempio n. 1
0
    def setSource(self, url):
        action, context, id = str(url).split('.')
        if action == 'show':
            if context == 'parent':
                win = TraitMainWindow(self.app, self.parent(), self.doc.suite)
                win.view.set_trait(id)
            elif context == 'template':
                fid = id.replace(',', '.')
                package, template = fid.split('...')
                win = ViewWindow(self.app, self.parent(), SimpleEdit,
                                 'TemplateView')
                templatefile = self.doc.trait._templates.templatedata(
                    package, template)
                win.view.setText(templatefile)
                win.resize(600, 800)
            elif context == 'script':
                scriptfile = self.doc.trait._scripts.scriptdata(id)
                win = ViewWindow(self.app, self.parent(), SimpleEdit,
                                 'ScriptView')
                win.view.setText(scriptfile)
                win.resize(600, 800)
            else:
                self._url_error(url)
        elif action == 'edit':
            if context == 'templates':
                #win = KFileDialog('.', '*', self, 'hello file dialog', False)
                #win.show()
                #win = TemplateEditorWindow(self.app, self.parent(), self.doc.suite)
                win = KFileDialog('.', '', self, 'SystemTarball', True)
                self.connect(win, SIGNAL('okClicked()'), self.fileSelected)
                win.show()
                self._dialog = win

            elif context == 'packages':
                win = PackageSelectorWindow(self.app, self.parent(),
                                            self.doc.suite)
            elif context == 'script':
                self.doc.trait.edit_script(id)
            elif context == 'template':
                fid = id.replace(',', '.')
                package, template = fid.split('...')
                self.doc.trait.edit_template(package, template)
            else:
                self._url_error(url)
        elif action == 'new':
            if context == 'package':
                win = SimpleRecordDialog(self, ['package', 'action'])
                win.connect(win, SIGNAL('okClicked()'), self.slotAddPackage)
                win.setRecordData(dict(action='install'))
                self._dialog = win
        else:
            self._url_error(url)
Esempio n. 2
0
 def setSource(self, url):
     action, context, id_ = split_url(url)
     fields = []
     if context == 'Disks':
         fields = ['diskname', 'device']
     elif context == 'Families':
         fields = ['family']
     elif context == 'Variables':
         fields = ['trait', 'name', 'value']
     if action == 'new':
         if context == 'Scripts':
             dialog = NewMTScriptDialog(self)
             dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewScript)
             self._dialog = dialog
         elif fields:
             dialog = SimpleRecordDialog(self, fields)
             dialog.context = context
             dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewRecord)
             self._dialog = dialog
         else:
             self._info('problem with %s' % url)
     elif action == 'edit':
         if context == 'Variables':
             self.doc.mtype.edit_variables()
         elif context == 'Scripts':
             self.doc.mtype.edit_script(id_)
         else:
             self._info('need to edit %s, %s' % (context, id_))
     elif action == 'delete':
         if context == 'Families':
             self.doc.mtype.delete_family(id_)
         elif context == 'Variables':
             self._info('use edit to delete variables')
         elif context == 'Scripts':
             self.doc.mtype.delete_script(id_)
         elif context == 'Modules':
             self._info('Deleting modules not supported')
         else:
             self._info('need to delete something in context %s, %s' % (context, id_))
     else:
         KMessageBox.information(self, 'called %s' % url)
     self.resetView()
Esempio n. 3
0
 def newFamily(self):
     dialog = SimpleRecordDialog(self, ['family'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewFamily)
     self._dialog = dialog
Esempio n. 4
0
 def newTrait(self):
     dialog = SimpleRecordDialog(self, ['trait'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewTrait)
     self._dialog = dialog
Esempio n. 5
0
 def newProfile(self):
     dialog = SimpleRecordDialog(self, ['profile'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewProfile)
     self._dialog = dialog
Esempio n. 6
0
 def newFamily(self):
     dialog = SimpleRecordDialog(self, ['family'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewFamily)
     self._dialog = dialog
Esempio n. 7
0
 def slotNewTag(self):
     dlg = SimpleRecordDialog(self, ['tag', 'value'])
     dlg.connect(dlg, SIGNAL('okClicked()'), self.insertTag)
     dlg.connect(dlg, PYSIGNAL('updated()'), self.mainView.refreshlistView)
     self.dialogs['new-tag'] = dlg
Esempio n. 8
0
 def newTrait(self):
     dialog = SimpleRecordDialog(self, ['trait'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewTrait)
     self._dialog = dialog
Esempio n. 9
0
 def __init__(self, parent, name='AddGroupDialog'):
     fields = ['groupname']
     SimpleRecordDialog.__init__(self, parent, fields, name=name)
Esempio n. 10
0
 def __init__(self, parent, name='AddUserDialog'):
     fields = ['username']
     SimpleRecordDialog.__init__(self, parent, fields, name=name)
Esempio n. 11
0
 def slotAddDbSchema(self):
     dlg = SimpleRecordDialog(self, ['schema'], 'AddDbSchemaDialog')
     dlg.connect(dlg, SIGNAL('okClicked()'), self.addDbSchemaok)
     self.dialogs['new-schema'] = dlg
Esempio n. 12
0
 def newProfile(self):
     dialog = SimpleRecordDialog(self, ['profile'])
     dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewProfile)
     self._dialog = dialog