示例#1
0
    def saveEditor(self, editor=None, saveAs=False):
        editor = editor or self.currentEditor()
        if editor.isExternalChanged():
            message = "The file '%s' has been changed on the file system, Do you want save the file with other name?"
            result = QtGui.QMessageBox.question(
                editor,
                _("File changed"),
                _(message) % editor.filePath,
                buttons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
                defaultButton=QtGui.QMessageBox.Yes)
            if result == QtGui.QMessageBox.Yes:
                saveAs = True
        if editor.isNew() or saveAs:
            fileDirectory = self.application.fileManager.directory(
                self.projects.currentPath()) if editor.isNew(
                ) else editor.fileDirectory()
            fileName = editor.fileName()
            fileFilters = editor.fileFilters()
            # TODO Armar el archivo destino y no solo el basedir
            filePath, _ = getSaveFileName(
                self,
                caption="Save file as" if saveAs else "Save file",
                basedir=fileDirectory,
                filters=fileFilters)
        else:
            filePath = editor.filePath

        if filePath:
            editor.save(filePath)
示例#2
0
文件: project.py 项目: D3f0/prymatex
    def runCreateProject(self, name, location):
        try:
            self.projectCreated = self.application.projectManager.createProject(name, location)
        except exceptions.ProjectExistsException:
            rslt = QtGui.QMessageBox.information(None, 
                _("Project already created on %s") % name,
                _("Directory %s already contains .pmxproject directory structure. "
                "Unless you know what you are doing, Cancel and import project,"
                " if it still fails, choose overwirte. Overwrite?") % location,
                QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel) 
            if rslt == QtGui.QMessageBox.Cancel:
                self.cancel()
            self.projectCreated = self.application.projectManager.createProject(name, location, overwrite = True)

        self.application.projectManager.updateProject(self.projectCreated,
            description = self.textDescription.toPlainText(),
            licence = self.comboBoxLicence.currentText(),
            keywords = self.comboBoxKeywords.model().selectedItems())

        #Set template's bundle for project
        if self.checkBoxUseTemplate.isChecked():
            index = self.projectProxyModel.createIndex(self.comboBoxTemplate.currentIndex(), 0)
            template = self.projectProxyModel.node(index)
            self.projectCreated.addBundleMenu(template.bundle)

        self.accept()
示例#3
0
文件: app.py 项目: diegomvh/prymatex
 def checkExternalAction(self, mainWindow, editor):
     if editor.isExternalChanged():
         message = "The file '%s' has been changed on the file system, Do you want to replace the editor contents with these changes?"
         result = QtGui.QMessageBox.question(editor, _("File changed"),
             _(message) % editor.filePath,
             buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
             defaultButton = QtGui.QMessageBox.Yes)
         if result == QtGui.QMessageBox.Yes:
             cursorPosition = editor.cursorPosition()
             def on_editorReady(editor, cursorPosition):
                 def editorReady(openResult):
                     editor.setCursorPosition(cursorPosition)
                 return editorReady
             if inspect.isgeneratorfunction(editor.reload):
                 task = self.scheduler.newTask( editor.reload() )
                 task.done.connect( on_editorReady(editor, cursorPosition) )
             else:
                 on_editorReady(editor, cursorPosition)(editor.reload())
         elif result == QtGui.QMessageBox.No:
             pass
     elif editor.isExternalDeleted():
         message = "The file '%s' has been deleted or is not accessible. Do you want to save your changes or close the editor without saving?"
         result = QtGui.QMessageBox.question(editor, _("File deleted"),
             _(message) % editor.filePath,
             buttons = QtGui.QMessageBox.Save | QtGui.QMessageBox.Close,
             defaultButton = QtGui.QMessageBox.Close)
         if result == QtGui.QMessageBox.Close:
             mainWindow.closeEditor(editor)
         elif result == QtGui.QMessageBox.Save:
             mainWindow.saveEditor(editor)
示例#4
0
文件: profile.py 项目: D3f0/prymatex
 def on_buttonRename_pressed(self):
     profile = self.manager.profilesListModel.profile(self.listViewProfiles.currentIndex())
     profileNewName, ok = QtGui.QInputDialog.getText(self, _("Rename profile"), _(RENAME_MESSAGE) % profile.PMX_PROFILE_NAME, text=profile.PMX_PROFILE_NAME)
     while profileNewName in self.manager.profileNames():
         profileNewName, ok = QtGui.QInputDialog.getText(self, _("Rename profile"), _(RENAME_MESSAGE) % profile.PMX_PROFILE_NAME, text=profileNewName)
     if ok:
         self.manager.renameProfile(profile, profileNewName)
示例#5
0
 def on_buttonCreate_pressed(self):
     profileName, ok = QtGui.QInputDialog.getText(self, _("Create profile"), _(CREATE_MESSAGE))
     while profileName in PMXProfile.PMX_PROFILES.keys():
         profileName, ok = QtGui.QInputDialog.getText(self, _("Create profile"), _(CREATE_MESSAGE))
     if ok:
         profileName = PMXProfile.createProfile(profileName)
         self.listProfiles.addItem(QtGui.QListWidgetItem(QtGui.QIcon.fromTheme("user-identity"), profileName))
示例#6
0
 def checkExternalAction(self, mainWindow, editor):
     if editor.isExternalChanged():
         message = "The file '%s' has been changed on the file system, Do you want to replace the editor contents with these changes?"
         result = QtGui.QMessageBox.question(
             editor,
             _("File changed"),
             _(message) % editor.filePath,
             buttons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
             defaultButton=QtGui.QMessageBox.Yes
         ) if self.askAboutExternalActions else QtGui.QMessageBox.Yes
         if result == QtGui.QMessageBox.Yes:
             if inspect.isgeneratorfunction(editor.reload):
                 task = self.scheduler.newTask(editor.reload())
             else:
                 editor.reload()
         elif result == QtGui.QMessageBox.No:
             pass
     elif editor.isExternalDeleted():
         message = "The file '%s' has been deleted or is not accessible. Do you want to save your changes or close the editor without saving?"
         result = QtGui.QMessageBox.question(
             editor,
             _("File deleted"),
             _(message) % editor.filePath,
             buttons=QtGui.QMessageBox.Save | QtGui.QMessageBox.Close,
             defaultButton=QtGui.QMessageBox.Close
         ) if self.askAboutExternalActions else QtGui.QMessageBox.Close
         if result == QtGui.QMessageBox.Close:
             mainWindow.closeEditor(editor)
         elif result == QtGui.QMessageBox.Save:
             mainWindow.saveEditor(editor)
示例#7
0
    def runCreateProject(self, name, file_path, folder_path):
        folders = [ folder_path ] if folder_path else []
        try:
            self.projectCreated = self.application().projectManager.createProject(name, file_path, folders=folders)
        except exceptions.ProjectExistsException:
            rslt = QtWidgets.QMessageBox.information(None, 
                _("Project file already exists"),
                _("The %s path already exists. "
                "Unless you know what you are doing, Cancel and open project,"
                " if it still fails, choose overwirte. Overwrite?") % file_path,
                QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel) 
            if rslt == QtWidgets.QMessageBox.Cancel:
                self.cancel()
            self.projectCreated = self.application().projectManager.createProject(name, file_path, folders=folders, overwrite=True)

        self.application().projectManager.updateProject(self.projectCreated,
            description = self.textEditDescription.toPlainText(),
            licence = self.comboBoxLicence.currentText(),
            keywords = self.comboBoxKeywords.model().selectedItems())

        #Set template's bundle for project
        if self.checkBoxUseTemplate.isChecked():
            index = self.projectProxyModel.createIndex(self.comboBoxTemplate.currentIndex(), 0)
            template = self.projectProxyModel.node(index)
            self.projectCreated.addBundleMenu(template.bundle)

        self.accept()
示例#8
0
文件: window.py 项目: D3f0/prymatex
    def saveEditor(self, editor = None, saveAs = False):
        editor = editor or self.currentEditor()
        if editor.isExternalChanged():
            message = "The file '%s' has been changed on the file system, Do you want save the file with other name?"
            result = QtGui.QMessageBox.question(editor, _("File changed"),
                _(message) % editor.filePath(),
                buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
                defaultButton = QtGui.QMessageBox.Yes)
            if result == QtGui.QMessageBox.Yes:
                saveAs = True
        if editor.isNew() or saveAs:
            fileDirectory = self.application.fileManager.directory(self.projectsDock.currentPath()) if editor.isNew() else editor.fileDirectory()
            fileName = editor.title()
            fileFilters = editor.fileFilters()
            # TODO Armar el archivo destino y no solo el basedir
            file_path, _ = getSaveFileName(
                self,
                caption = "Save file as" if saveAs else "Save file",
                basedir = fileDirectory,
                filters = fileFilters
            )
        else:
            file_path = editor.filePath()

        if file_path:
            editor.save(file_path)
示例#9
0
 def createProject(self, name, directory, description = None, reuseDirectory = True):
     """
     Crea un proyecto nuevo lo agrega en los existentes y lo retorna,
     """
     #TODO: dejar este trabajo al file manager
     if not os.path.exists(directory):
         os.makedirs(directory)
     elif not reuseDirectory:
         raise Exception()
     project = ProjectTreeNode(directory, { "name": name, "description": description })
     try:
         project.save()
     except ProjectExistsException:
         rslt = QtGui.QMessageBox.information(None, _("Project already created on %s") % name,
                                       _("Directory %s already contains .pmxproject directory structure. "
                                         "Unless you know what you are doing, Cancel and import project,"
                                         " if it still fails, choose overwirte. Overwrite?") % directory,
                                       QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel) 
         if rslt == QtGui.QMessageBox.Cancel:
             return
         try:
             project.save(overwirte = True)
         except FileException as excp:
             QtGui.QMessageBox.critical(None, _("Project creation failed"), 
                                        _("<p>Project %s could not be created<p><pre>%s</pre>") % (name, excp))
     self.addProject(project)
     self.appendToKnowProjects(project)
     return project
示例#10
0
 def __init__(self, parent):
     QtGui.QDockWidget.__init__(self, parent)
     PMXBaseDock.__init__(self)
     self.setWindowTitle(_("Terminal"))
     self.setObjectName(_("TerminalDock"))
     self.tabTerminals = PMXTabTerminals(self)
     self.setWidget(self.tabTerminals)
     self.installEventFilter(self)
示例#11
0
 def on_buttonRename_pressed(self):
     profileOldName = self.listProfiles.item(self.listProfiles.currentRow()).data(QtCore.Qt.DisplayRole)
     profileNewName, ok = QtGui.QInputDialog.getText(self, _("Rename profile"), _(RENAME_MESSAGE) % profileOldName, text=profileOldName)
     while profileNewName in PMXProfile.PMX_PROFILES.keys():
         profileNewName, ok = QtGui.QInputDialog.getText(self, _("Rename profile"), _(RENAME_MESSAGE) % profileOldName, text=profileNewName)
     if ok:
         newName = PMXProfile.renameProfile(profileOldName, profileNewName)
         self.listProfiles.item(self.listProfiles.currentRow()).setData(QtCore.Qt.DisplayRole, newName)
示例#12
0
文件: profile.py 项目: D3f0/prymatex
 def on_buttonDelete_pressed(self):
     profile = self.manager.profilesListModel.profile(self.listViewProfiles.currentIndex())
     result = QtGui.QMessageBox.question(self, _("Delete Profile"),
         _(DELETE_MESSAGE) % profile.PMX_PROFILE_NAME,
         buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.Ok | QtGui.QMessageBox.Discard,
         defaultButton = QtGui.QMessageBox.Ok)
     if result != QtGui.QMessageBox.Discard:
         self.manager.deleteProfile(profile, result == QtGui.QMessageBox.Yes)
示例#13
0
 def on_pushButtonCustomFilters_pressed(self):
     filters, accepted = QtGui.QInputDialog.getText(self, _("Custom Filter"), 
                                                     _("Enter the filters (separated by comma)\nOnly * and ? may be used for custom matching"), 
                                                     text = self.customFilters)
     if accepted:
         #Save and set filters
         self.settings.setValue('customFilters', filters)
         self.projectTreeProxyModel.setFilterRegExp(filters)
示例#14
0
 def deletePathDialog(self, path, widget=None):
     basePath, pathTail = os.path.split(path)
     result = QtWidgets.QMessageBox.question(widget, _("Are you sure?"), 
                                     _("Are you sure you want to delete %s<br>"
                                       "This action can not be undone.") % pathTail,
                                         buttons = QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
                                         defaultButton = QtWidgets.QMessageBox.Cancel)
     if result == QtWidgets.QMessageBox.Ok:
         self.deletePath(path)
示例#15
0
 def setupDialogs(self):
     from prymatex.gui.dialogs.selector import PMXSelectorDialog
             
     # Create dialogs
     self.bundleSelectorDialog = PMXSelectorDialog(self, title = _("Select Bundle Item"))
     # TODO: Connect these selectors 
     self.tabSelectorDialog = PMXSelectorDialog(self, title = _("Select tab"))
     self.symbolSelectorDialog = PMXSelectorDialog(self, title = _("Select Symbol"))
     self.bookmarkSelectorDialog = PMXSelectorDialog(self, title = _("Select Bookmark"))
示例#16
0
 def deletePath(self, path):
     basePath, pathTail = os.path.split(path)
     result = QtWidgets.QMessageBox.question(self, _("Are you sure?"), 
                                     _("Are you sure you want to delete %s<br>"
                                       "This action can not be undone.") % pathTail,
                                         buttons = QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
                                         defaultButton = QtWidgets.QMessageBox.Cancel)
     if result == QtWidgets.QMessageBox.Ok:
         self.application().fileManager.deletePath(path)
示例#17
0
 def on_buttonDelete_pressed(self):
     item = self.listProfiles.item(self.listProfiles.currentRow())
     profileOldName = item.data(QtCore.Qt.DisplayRole)
     result = QtGui.QMessageBox.question(self, _("Delete Profile"),
         _(DELETE_MESSAGE) % profileOldName,
         buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.Ok | QtGui.QMessageBox.Discard,
         defaultButton = QtGui.QMessageBox.Ok)
     if result != QtGui.QMessageBox.Discard:
         PMXProfile.deleteProfile(profileOldName, result == QtGui.QMessageBox.Yes)
         self.listProfiles.removeItemWidget(item)
示例#18
0
 def on_pushButtonCustomFilters_pressed(self):
     filters, accepted = QtGui.QInputDialog.getText(
         self,
         _("Custom Filter"),
         _("Enter the filters (separated by comma)\nOnly * and ? may be used for custom matching"
           ),
         text=self.customFilters)
     if accepted:
         #Save and set filters
         self.settings.setValue('customFilters', filters)
         self.projectTreeProxyModel.setFilterRegExp(filters)
示例#19
0
 def deletePath(self, path):
     basePath, pathTail = os.path.split(path)
     result = QtGui.QMessageBox.question(
         self,
         _("Are you sure?"),
         _("Are you sure you want to delete %s<br>"
           "This action can not be undone.") % pathTail,
         buttons=QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel,
         defaultButton=QtGui.QMessageBox.Cancel)
     if result == QtGui.QMessageBox.Ok:
         self.application.fileManager.deletePath(path)
示例#20
0
 def on_buttonCreate_pressed(self):
     profileName, ok = QtGui.QInputDialog.getText(self, _("Create profile"),
                                                  _(CREATE_MESSAGE))
     while profileName in PMXProfile.PMX_PROFILES.keys():
         profileName, ok = QtGui.QInputDialog.getText(
             self, _("Create profile"), _(CREATE_MESSAGE))
     if ok:
         profileName = PMXProfile.createProfile(profileName)
         self.listProfiles.addItem(
             QtGui.QListWidgetItem(QtGui.QIcon.fromTheme("user-identity"),
                                   profileName))
示例#21
0
 def insertBundleItem(self, bundleItem, **processorSettings):
     '''Insert selected bundle item in current editor if possible'''
     editor = self.currentEditor()
     if editor is not None:
         self.currentEditor().insertBundleItem(bundleItem)
     elif not bundleItem.isEditorNeeded():
         print "vamos con nuestro processor"
         self.commandProcessor.configure(processorSettings)
         bundleItem.execute(self.commandProcessor)
     else:
         QtGui.QMessageBox.information(self, _("No editor open"), 
                                       _("%s needs an editor to run") % bundleItem.name)
示例#22
0
    def setupDialogs(self):
        from prymatex.gui.dialogs.selector import PMXSelectorDialog

        # Create dialogs
        self.bundleSelectorDialog = PMXSelectorDialog(
            self, title=_("Select Bundle Item"))
        # TODO: Connect these selectors
        self.tabSelectorDialog = PMXSelectorDialog(self, title=_("Select tab"))
        self.symbolSelectorDialog = PMXSelectorDialog(self,
                                                      title=_("Select Symbol"))
        self.bookmarkSelectorDialog = PMXSelectorDialog(
            self, title=_("Select Bookmark"))
示例#23
0
 def retranslateUi(self, BrowserDock):
     BrowserDock.setWindowTitle(_('Web Browser'))
     self.buttonBack.setToolTip(_('Back'))
     self.buttonNext.setToolTip(_('Next'))
     self.buttonReload.setToolTip(_('Reload'))
     self.buttonStop.setToolTip(_('Stop'))
     self.actionSyncEditor.setText(_('Sync Editor'))
     self.actionSyncEditor.setToolTip(_('Sync browser with current editor content'))
     self.actionConnectEditor.setText(_('Connect Editor'))
     self.actionConnectEditor.setToolTip(_('Connect browser with current editor'))
示例#24
0
 def on_buttonDelete_pressed(self):
     item = self.listProfiles.item(self.listProfiles.currentRow())
     profileOldName = item.data(QtCore.Qt.DisplayRole)
     result = QtGui.QMessageBox.question(self,
                                         _("Delete Profile"),
                                         _(DELETE_MESSAGE) % profileOldName,
                                         buttons=QtGui.QMessageBox.Yes
                                         | QtGui.QMessageBox.Ok
                                         | QtGui.QMessageBox.Discard,
                                         defaultButton=QtGui.QMessageBox.Ok)
     if result != QtGui.QMessageBox.Discard:
         PMXProfile.deleteProfile(profileOldName,
                                  result == QtGui.QMessageBox.Yes)
         self.listProfiles.removeItemWidget(item)
示例#25
0
 def copyPathDialog(self, srcPath, dstPath, widget=None, override=False):
     ''' Copy files and folders '''
     basename = self.basename(dstPath)
     dirname = self.dirname(dstPath)
     while not override and self.exists(dstPath):
         basename, ret = ReplaceRenameInputDialog.getText(widget, _("Already exists"), 
             _("Destiny already exists\nReplace or or replace?"), text = basename, )
         if ret == ReplaceRenameInputDialog.Cancel: return
         if ret == ReplaceRenameInputDialog.Replace: break
         dstPath = os.path.join(dirname, basename)
     if os.path.isdir(srcPath):
         self.copytree(srcPath, dstPath)
     else:
         self.copy(srcPath, dstPath)
示例#26
0
文件: dockers.py 项目: D3f0/prymatex
 def __init__(self, **kwargs):
     super(CodeEditorBookmarksDock, self).__init__(**kwargs)
     self.setWindowTitle(_("Bookmarks"))
     self.setObjectName(_("BookmarksDock"))
     self.tableViewBookmarks = QtGui.QTableView()
     self.tableViewBookmarks.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
     self.tableViewBookmarks.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
     self.tableViewBookmarks.setShowGrid(False)
     self.tableViewBookmarks.horizontalHeader().setVisible(False)
     self.tableViewBookmarks.verticalHeader().setVisible(False)
     self.tableViewBookmarks.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.tableViewBookmarks.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.tableViewBookmarks.activated.connect(self.on_tableViewBookmarks_activated)
     self.tableViewBookmarks.doubleClicked.connect(self.on_tableViewBookmarks_doubleClicked)
     self.setWidget(self.tableViewBookmarks)
示例#27
0
 def __init__(self, **kwargs):
     super(TerminalDock, self).__init__(**kwargs)
     self.setWindowTitle(_("Terminal"))
     self.setObjectName(_("TerminalDock"))
     self.tabTerminals = TabbedTerminal(self)
     self.setWidget(self.tabTerminals)
     
     # Manager
     self.backendManager = BackendManager(parent = self)
     self.application().aboutToQuit.connect(self.backendManager.stopAll)
     
     # Local Backend
     self.backend = self.backendManager.localBackend()
     self.backend.started.connect(self.tabTerminals.newTerminal)
     self.backend.start()
示例#28
0
 def __init__(self, parent):
     QtGui.QDockWidget.__init__(self, parent)
     self.setWindowTitle(_("Symbols"))
     self.setObjectName(_("SymbolsDock"))
     PMXBaseDock.__init__(self)
     self.tableViewSymbols = QtGui.QTableView()
     self.tableViewSymbols.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
     self.tableViewSymbols.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
     self.tableViewSymbols.setShowGrid(False)
     self.tableViewSymbols.horizontalHeader().setVisible(False)
     self.tableViewSymbols.verticalHeader().setVisible(False)
     self.tableViewSymbols.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.tableViewSymbols.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.tableViewSymbols.activated.connect(self.on_tableViewSymbols_activated)
     self.tableViewSymbols.doubleClicked.connect(self.on_tableViewSymbols_doubleClicked)
     self.setWidget(self.tableViewSymbols)
示例#29
0
 def on_pushButtonChangeFont_pressed(self):
     font = self.settings().get("font")
     font, ok = QtWidgets.QFontDialog.getFont(font, self, _("Select terminal font"))
     if ok:
         self.settings().set("font", font)
         self.comboBoxFontName.setCurrentFont(font)
         self.spinBoxFontSize.set(font.pointSize())
示例#30
0
文件: terminal.py 项目: D3f0/prymatex
 def on_pushButtonChangeFont_pressed(self):
     font = self.settings.value('font')
     font, ok = QtGui.QFontDialog.getFont(font, self, _("Select terminal font"))
     if ok:
         self.settings.setValue('font', font)
         self.comboBoxFontName.setCurrentFont(font)
         self.spinBoxFontSize.setValue(font.pointSize())
示例#31
0
 def on_pushButtonChangeFont_pressed(self):
     font = self.settingGroup.value('font')
     font, ok = QtGui.QFontDialog.getFont(font, self, _("Select terminal font"))
     if ok:
         self.settingGroup.setValue('font', font)
         self.lineFont.setFont(font)
         self.lineFont.setText("%s, %d" % (font.family(), font.pointSize()))
示例#32
0
 def retranslateUi(self, ProfileDialog):
     ProfileDialog.setWindowTitle(_('Prymatex Choose User Profile'))
     self.label.setText(_('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n<html><head><meta name="qrichtext" content="1" /><style type="text/css">\np, li { white-space: pre-wrap; }\n</style></head><body style=" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;">\n<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Prymatex stores information about your settings, preferences and other items in your user profile.</p></body></html>'))
     self.buttonCreate.setText(_('&Create Profile'))
     self.buttonRename.setText(_('&Rename Profile'))
     self.buttonDelete.setText(_('&Delete Profile'))
     self.checkDontAsk.setText(_('Don\'t a&sk at startup'))
     self.buttonExit.setText(_('Exit'))
     self.buttonStartPrymatex.setText(_('Start Prymatex'))
 def retranslateUi(self, FSSettingsDialog):
     FSSettingsDialog.setWindowTitle(_('File System Panel Settings'))
     self.label.setText(_('Include Files...'))
     self.label_2.setText(_('Exclude Files...'))
     self.label_3.setText(_('Include Dirs...'))
     self.label_4.setText(_('Exclude Dirs...'))
     self.label_5.setText(_('Use commas for filter separation, i.e. *.o, *~'))
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabFilters), _('Filters'))
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabEnviroment), _('Enviroment'))
示例#34
0
 def on_pushButtonChangeFont_pressed(self):
     font = self.settingGroup.value('font')
     font, ok = QtGui.QFontDialog.getFont(font, self,
                                          _("Select editor font"))
     if ok:
         self.settingGroup.setValue('font', font)
         self.lineFont.setFont(font)
         self.lineFont.setText("%s, %d" % (font.family(), font.pointSize()))
示例#35
0
    def __init__(self, parent):
        QtGui.QDockWidget.__init__(self, parent)
        self.setWindowTitle(_("External process"))
        self.setObjectName(_("ExternalProcessDock"))
        PMXBaseDock.__init__(self)
        self.processTableModel = self.application.supportManager.processTableModel
        self.tableViewProcess = QtGui.QTableView()
        self.tableViewProcess.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.tableViewProcess.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.tableViewProcess.setShowGrid(False)
        self.tableViewProcess.horizontalHeader().setVisible(False)
        self.tableViewProcess.verticalHeader().setVisible(False)
        self.tableViewProcess.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.tableViewProcess.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.tableViewProcess.activated.connect(self.on_tableViewProcess_activated)
        self.tableViewProcess.doubleClicked.connect(self.on_tableViewProcess_doubleClicked)
        self.tableViewProcess.setModel(self.processTableModel)
        self.setWidget(self.tableViewProcess)

        #Setup Context Menu
        contextMenu = { 
            "text": "Process",
            "items": [ 
                { "text": "Close",
                  "callback": self.on_actionCloseProcess_triggered },
                { "text": "Kill",
                  "callback": self.on_actionKill_triggered },
                { "text": "Terminate",
                  "callback": self.on_actionTerminate_triggered },
                "-",
                { "text": "Send Signal",
                  "items": map(lambda (key, value):
                        { "text": "%s (%s)" % (key, value),
                          "callback": lambda _, signal = value: self.on_actionSendSignal_triggered(signal)
                        }, sorted(SIGNALS.iteritems(), key = lambda (k, v): v))
                }
            ]
        }
        self.processMenu, self.processMenuActions = create_menu(self, contextMenu)

        for action in self.processMenuActions:
            if hasattr(action, "callback"):
                action.triggered.connect(action.callback)
        
        self.tableViewProcess.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.tableViewProcess.customContextMenuRequested.connect(self.showtableViewProcessContextMenu)
示例#36
0
 def createDirectory(self, basePath):
     if not os.path.isdir(basePath):
         # If base is a file, we should take its parent dir
         basePath = os.path.dirname(basePath)
     while True:
         newDirName, accepted = QtGui.QInputDialog.getText(self, _("Create Directory"), 
                                                     _("Please specify the new directory name"), 
                                                     text = _("New Folder"))
         if accepted:
             absNewDirName = os.path.join(basePath, newDirName)
             try:
                 rslt = self.application.fileManager.createDirectory(absNewDirName)
             except exceptions.PrymatexFileExistsException as e:
                 QtGui.QMessageBox.warning(self, _("Error creating directory"), 
                                           _("%s already exists") % newDirName)
                 continue
             # Permissions? Bad Disk? 
             except Exception as e:
                 # TODO: Show some info about the reason
                 QtGui.QMessageBox.warning(self, _("Error creating directory"), 
                                           _("An error occured while creating %s") % newDirName)
                 
             else:
                 break
         else:
             return
示例#37
0
 def on_buttonRename_pressed(self):
     profileOldName = self.listProfiles.item(
         self.listProfiles.currentRow()).data(QtCore.Qt.DisplayRole)
     profileNewName, ok = QtGui.QInputDialog.getText(self,
                                                     _("Rename profile"),
                                                     _(RENAME_MESSAGE) %
                                                     profileOldName,
                                                     text=profileOldName)
     while profileNewName in PMXProfile.PMX_PROFILES.keys():
         profileNewName, ok = QtGui.QInputDialog.getText(
             self,
             _("Rename profile"),
             _(RENAME_MESSAGE) % profileOldName,
             text=profileNewName)
     if ok:
         newName = PMXProfile.renameProfile(profileOldName, profileNewName)
         self.listProfiles.item(self.listProfiles.currentRow()).setData(
             QtCore.Qt.DisplayRole, newName)
示例#38
0
 def retranslateUi(self, ProfileDialog):
     ProfileDialog.setWindowTitle(_('Prymatex Choose User Profile'))
     self.label.setText(
         _('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n<html><head><meta name="qrichtext" content="1" /><style type="text/css">\np, li { white-space: pre-wrap; }\n</style></head><body style=" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;">\n<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Prymatex stores information about your settings, preferences and other items in your user profile.</p></body></html>'
           ))
     self.buttonCreate.setText(_('&Create Profile'))
     self.buttonRename.setText(_('&Rename Profile'))
     self.buttonDelete.setText(_('&Delete Profile'))
     self.checkDontAsk.setText(_('Don\'t a&sk at startup'))
     self.buttonExit.setText(_('Exit'))
     self.buttonStartPrymatex.setText(_('Start Prymatex'))
示例#39
0
    def setup_and_check(self, data, title='', editable=False,
                        xlabels=None, ylabels=None):
        """
        Setup ListEditor:
        return False if data is not supported, True otherwise
        """
        self.data = data
        if len(data) == 0:
            self.error(_("List is empty"))
            return False
        
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)
        if title:
            title = str(title) # in case title is not a string
        else:
            title = _("List editor")
        if editable:
            title += ' (' + _('read only') + ')'
        self.setWindowTitle(title)
        self.resize(600, 500)
        
        # Stack widget
        self.stack = QtGui.QStackedWidget(self)
        self.tablewidget = TableEditorWidget(data, editable, xlabels, ylabels, parent = self)
        self.stack.addWidget(self.tablewidget)
        self.connect(self.stack, QtCore.SIGNAL('currentChanged(int)'),
                     self.current_widget_changed)
        self.layout.addWidget(self.stack, 1, 0)

        # Buttons configuration
        btn_layout = QtGui.QHBoxLayout()
        bbox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
        self.connect(bbox, QtCore.SIGNAL("accepted()"), QtCore.SLOT("accept()"))
        self.connect(bbox, QtCore.SIGNAL("rejected()"), QtCore.SLOT("reject()"))
        btn_layout.addWidget(bbox)
        self.layout.addLayout(btn_layout, 2, 0)
        
        self.setMinimumSize(400, 300)
        
        # Make the dialog act as a window
        self.setWindowFlags(QtCore.Qt.Window)
        
        return True
示例#40
0
 def retranslateUi(self, NewFromTemplateDialog):
     NewFromTemplateDialog.setWindowTitle(_('New From Template'))
     self.label_3.setText(_('Template:'))
     self.label_2.setText(_('Location:'))
     self.buttonChoose.setText(_('Ch&oose'))
     self.label.setText(_('File Name:'))
     self.buttonCreate.setText(_('&Create'))
     self.buttonCancel.setText(_('C&ancel'))
示例#41
0
 def retranslateUi(self, Command):
     Command.setWindowTitle(_('Form'))
     self.label.setText(_('Save:'))
     self.pushButtonOptions.setText(_('Options'))
     self.label_2.setText(_('Command(s):'))
     self.label_3.setText(_('Input:'))
     self.labelInputOption.setText(_('or'))
     self.label_4.setText(_('Output:'))
示例#42
0
 def retranslateUi(self, NewFromTemplateDialog):
     NewFromTemplateDialog.setWindowTitle(_('New From Template'))
     self.label1.setText(_('File Name:'))
     self.label2.setText(_('Location:'))
     self.buttonChoose.setText(_('Ch&oose'))
     self.label3.setText(_('Template:'))
     self.buttonCreate.setText(_('&Create'))
     self.buttonCancel.setText(_('C&ancel'))
示例#43
0
 def retranslateUi(self, FileManagerDialog):
     FileManagerDialog.setWindowTitle(_('File Manager'))
     self.label.setText(_('Save when'))
     self.checkBoxSaveWhenFocusIsLost.setText(_('Focus is Lost'))
     self.checkBoxSaveEvery.setText(_('Perform Backups every'))
     self.label_2.setText(_('minutes'))
     self.label_3.setText(_('Encoding'))
     self.label_4.setText(_('Line Ending'))
示例#44
0
 def retranslateUi(self, BrowserWidget):
     BrowserWidget.setWindowTitle(_('Browser'))
     self.checkBoxDeveloperExtras.setText(_('Enable developer extras'))
     self.groupBox.setTitle(_('Connection'))
     self.radioButtonNoProxy.setText(_('No proxy'))
     self.radioButtonSystemProxy.setText(_('Use system proxy settings'))
     self.radioButtonManualProxy.setText(_('Manual proxy configuration:'))
     self.labelProxy.setText(_('Proxy:'))
示例#45
0
 def retranslateUi(self, FSSettingsDialog):
     FSSettingsDialog.setWindowTitle(_('File System Panel Settings'))
     self.label.setText(_('Include Files...'))
     self.label_2.setText(_('Exclude Files...'))
     self.label_3.setText(_('Include Dirs...'))
     self.label_4.setText(_('Exclude Dirs...'))
     self.label_5.setText(
         _('Use commas for filter separation, i.e. *.o, *~'))
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabFilters),
                               _('Filters'))
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabEnviroment),
                               _('Enviroment'))
示例#46
0
 def addTerminal(self, cmd = None, autoFocus = True):
     widget, title = None, "Terminal"
     try:
         widget = self.getTerminal(cmd)
         if not cmd:
             title = "Terminal (PID: %d)" % widget.getShellPID()
         else:
             title = cmd
         
     except (ImportError, AttributeError) as exc:
         from traceback import format_exc
         tb = format_exc()
         widget = QtGui.QTextEdit()
         widget.setReadOnly(True)
         widget.setText(_(QTERMWIDGET_IMPORT_SUGGESTOIN).format(tb))
         title = _("Import Error")
     self.addTab(widget, title)
     if autoFocus:
         self.setCurrentWidget(widget)
         widget.setFocus()
示例#47
0
    def __init__(self, settingGroup, parent=None):
        QtGui.QWidget.__init__(self, parent)
        SettingsTreeNode.__init__(self, "terminal", settingGroup)
        self.setupUi(self)

        try:
            from QTermWidget import QTermWidget
        except ImportError:
            return

        t = QTermWidget()

        self.comboScrollBar.addItem(_("No scrollbar"), t.NoScrollBar)
        self.comboScrollBar.addItem(_("Left scrollbar"), t.ScrollBarLeft)
        self.comboScrollBar.addItem(_("Right scrollbar"), t.ScrollBarRight)

        for name in t.availableColorSchemes():
            self.comboColorScheme.addItem(name, name)

        del t
示例#48
0
 def retranslateUi(self, CrashDialog):
     CrashDialog.setWindowTitle(_('Prymatex Crash'))
     self.label.setText(_('Prymatex Has Crashed'))
     self.label_2.setText(
         _('Prymatex has crashed, an uncattched exception has been risen somewhere.\nIf you\'re a developer you could dig into the code and send a path if appopiate.\nFull detail about the exception has been pasted below.'
           ))
     self.label_3.setToolTip(_('No monkeys have been hurt in the process'))
     self.pushSendTraceback.setText(_('Send'))
     self.pushCopyTraceback.setText(_('Copy'))
     self.pushClose.setText(_('Close'))
示例#49
0
 def on_buttonChoose_pressed(self):
     directory = self.lineLocation.text()
     while True:
         path = QtGui.QFileDialog.getExistingDirectory(
             self, _("Choose Location for Project"), directory)
         if path:
             print path
             if not os.path.exists(path): continue
             path = os.path.abspath(path)
             self.lineLocation.setText(path)
             self.lineProjectName.setText(os.path.basename(path))
         return
示例#50
0
 def retranslateUi(self, Terminal):
     Terminal.setWindowTitle(_('Terminal'))
     self.groupBox_2.setTitle(_('Font'))
     self.pushButtonChangeFont.setText(_('&Change'))
     self.groupBox.setTitle(_('Appearance'))
     self.label.setText(_('Color Scheme'))
     self.label_2.setText(_('Scroll'))
示例#51
0
 def createProject(self,
                   name,
                   directory,
                   description=None,
                   reuseDirectory=True):
     """
     Crea un proyecto nuevo lo agrega en los existentes y lo retorna,
     """
     #TODO: dejar este trabajo al file manager
     if not os.path.exists(directory):
         os.makedirs(directory)
     elif not reuseDirectory:
         raise Exception()
     project = ProjectTreeNode(directory, {
         "name": name,
         "description": description
     })
     try:
         project.save()
     except ProjectExistsException:
         rslt = QtGui.QMessageBox.information(
             None,
             _("Project already created on %s") % name,
             _("Directory %s already contains .pmxproject directory structure. "
               "Unless you know what you are doing, Cancel and import project,"
               " if it still fails, choose overwirte. Overwrite?") %
             directory, QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok,
             QtGui.QMessageBox.Cancel)
         if rslt == QtGui.QMessageBox.Cancel:
             return
         try:
             project.save(overwirte=True)
         except FileException as excp:
             QtGui.QMessageBox.critical(
                 None, _("Project creation failed"),
                 _("<p>Project %s could not be created<p><pre>%s</pre>") %
                 (name, excp))
     self.addProject(project)
     self.appendToKnowProjects(project)
     return project
示例#52
0
 def renamePath(self, path):
     ''' Renames files and folders '''
     basePath, pathTail = os.path.split(path)
     if os.path.isdir(path):
         pathType = _('directory')
     elif os.path.isfile(path):
         pathType = _('file')
     while True:
         newName, accepted = QtGui.QInputDialog.getText(
             self,
             _("Choose new name for %s") % pathTail,
             _("Rename {0} {1}").format(pathType, pathTail),
             text=pathTail)
         if accepted:
             if newName == pathTail:
                 continue  # Same name
             newFullPath = os.path.join(basePath, newName)
             if os.path.exists(newFullPath):
                 rslt = QtGui.QMessageBox.warning(
                     self,
                     _("Destination already exists"),
                     _("{0} already exists").format(newName),
                     buttons=QtGui.QMessageBox.Retry
                     | QtGui.QMessageBox.Cancel,
                     defaultButton=QtGui.QMessageBox.Retry)
                 if rslt == QtGui.QMessageBox.Cancel:
                     return
                 continue
             self.application.fileManager.move(path, newFullPath)
             return newFullPath
         else:
             return
示例#53
0
 def mousePressEvent(self, event):
     from QTermWidget import QTermWidget
     if event.button() == QtCore.Qt.RightButton:
         menu = QtGui.QMenu()
         widget = self.clickedItem(event.pos())
         if not widget:
             actionAddTerm = menu.addAction(_('Add terminal'))
             actionAddTerm.triggered.connect(self.addTerminal)
             
         else:
             pid = widget.getShellPID()
             # Close
             closeAction = menu.addAction(_("Close"))
             closeAction.triggered.connect(lambda index, s=self: s.removeTab(index))
             menu.addSeparator()
             # Signals
             signalSubMenu = menu.addMenu(_("&Send signal"))
             for name, number in SIGNALS:
                 signal = signalSubMenu.addAction("Send %s (%d)" % (name, number))
                 signal.triggered.connect(lambda pid = pid, number = number: os.kill(pid, number))
             # Scrollbar
             scrollBarMenu = QtGui.QMenu("Scrollbar")
             for name, enumVal in (("No Scrollbar", QTermWidget.NoScrollBar),
                                   ("Left Scrollbar",QTermWidget.ScrollBarLeft),
                                   ("Right Scrollbar", QTermWidget.ScrollBarRight)):
                 action = scrollBarMenu.addAction(name)
                 action.triggered.connect(lambda w=widget, n=enumVal: widget.setScrollBarPosition(n))
             menu.addMenu(scrollBarMenu)
             
             # Colors
             menuColors = QtGui.QMenu("Color Scheme")
             for name in widget.availableColorSchemes():
                 action = menuColors.addAction(name)
                 action.triggered.connect(lambda w=widget, n=name: widget.setColorScheme(n))
             
             menu.addMenu(menuColors)
             
         menu.exec_(event.globalPos())
         return
     super(PMXTabTerminals, self).mousePressEvent(event)
示例#54
0
 def __init__(self, mainWindow):
     QtGui.QDockWidget.__init__(self, mainWindow)
     PMXBaseDock.__init__(self)
     self.setWindowTitle(_("Bookmarks"))
     self.setObjectName(_("BookmarksDock"))
     self.tableViewBookmarks = QtGui.QTableView()
     self.tableViewBookmarks.setSelectionMode(
         QtGui.QAbstractItemView.SingleSelection)
     self.tableViewBookmarks.setSelectionBehavior(
         QtGui.QAbstractItemView.SelectRows)
     self.tableViewBookmarks.setShowGrid(False)
     self.tableViewBookmarks.horizontalHeader().setVisible(False)
     self.tableViewBookmarks.verticalHeader().setVisible(False)
     self.tableViewBookmarks.horizontalHeader().setResizeMode(
         QtGui.QHeaderView.ResizeToContents)
     self.tableViewBookmarks.verticalHeader().setResizeMode(
         QtGui.QHeaderView.ResizeToContents)
     self.tableViewBookmarks.activated.connect(
         self.on_tableViewBookmarks_activated)
     self.tableViewBookmarks.doubleClicked.connect(
         self.on_tableViewBookmarks_doubleClicked)
     self.setWidget(self.tableViewBookmarks)
示例#55
0
 def retranslateUi(self, SpellingDialog):
     SpellingDialog.setWindowTitle(_('Spelling'))
     self.label.setText(
         _('This word was not found in the spelling dictionary.'))
     self.pushButtonChange.setText(_('Change'))
     self.pushButtonFindNext.setText(_('Find Next'))
     self.pushButtonIgnore.setText(_('Ignore'))
     self.pushButtonLearn.setText(_('Learn'))
示例#56
0
    def setPathAsRoot(self, path, trackHistory=True):
        assert os.path.isdir(path), _("{0} is not a valid directory!").format(
            path)

        #Set del treeViewFileSystem
        oldPath = self.currentRootPath()
        sourceIndex = self.fileSystemModel.index(path)
        proxyIndex = self.fileSystemProxyModel.mapFromSource(sourceIndex)
        self.treeViewFileSystem.setRootIndex(proxyIndex)

        #Set del comboBoxLocation
        comboIndex = self.comboBoxLocation.model().index(path)
        #self.comboBoxLocation.setRootModelIndex(comboIndex)
        self.comboBoxLocation.setCurrentIndex(comboIndex.row())
        self.comboBoxLocation.lineEdit().setText(
            self.fileManager.normpath(path))

        #Store history
        if trackHistory and os.path.isdir(oldPath):
            self._pushButtonHistoryBack.append(oldPath)
            self.pushButtonBack.setEnabled(True)
            self._pushButtonHistoryForward = []
            self.pushButtonFoward.setEnabled(False)
示例#57
0
    def createFile(self, directory):
        while True:
            newFileName, accepted = QtGui.QInputDialog.getText(
                self,
                _("Create file"),
                _("Please specify the file name"),
                text=_("NewFile"))
            if not accepted:
                break

            absNewFileName = os.path.join(directory, newFileName)
            try:
                self.application.fileManager.createFile(absNewFileName)
                return absNewFileName
            except exceptions.FileExistsException as e:
                QtGui.QMessageBox.warning(self, _("Error creating file"),
                                          _("%s already exists") % newFileName)
            except Exception as e:
                # TODO: Show some info about the reason
                QtGui.QMessageBox.warning(
                    self, _("Error creating file"),
                    _("An error occured while creating %s") % absNewFileName)