def __init__(self, parent, available): QWidget.__init__(self, parent) self._parent = parent self._available = available vbox = QVBoxLayout(self) self._table = ui_tools.CheckableHeaderTable(1, 2) self._table.setSelectionMode(QTableWidget.SingleSelection) self._table.removeRow(0) vbox.addWidget(self._table) ui_tools.load_table( self._table, (translations.TR_PROJECT_NAME, translations.TR_VERSION), _format_for_table(available)) self._table.setColumnWidth(0, 500) self._table.setSortingEnabled(True) self._table.setAlternatingRowColors(True) hbox = QHBoxLayout() btnInstall = QPushButton(translations.TR_INSTALL) btnInstall.setMaximumWidth(100) hbox.addWidget(btnInstall) hbox.addWidget(QLabel(translations.TR_NINJA_NEEDS_TO_BE_RESTARTED)) vbox.addLayout(hbox) self.connect(btnInstall, SIGNAL("clicked()"), self._install_plugins) self.connect(self._table, SIGNAL("itemSelectionChanged()"), self._show_item_description)
def __init__(self, parent): super(SchemesManagerWidget, self).__init__(parent, Qt.Dialog) self.setWindowTitle(translations.TR_EDITOR_SCHEMES) self.resize(700, 500) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) # Footer hbox = QHBoxLayout() btn_close = QPushButton(self.tr('Close')) btnReload = QPushButton(self.tr("Reload")) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.show() self._schemes = [] self._loading = True self.downloadItems = [] #Load Themes with Thread self.connect(btnReload, SIGNAL("clicked()"), self._reload_themes) self._thread = ui_tools.ThreadExecution(self.execute_thread) self.connect(self._thread, SIGNAL("finished()"), self.load_skins_data) self.connect(btn_close, SIGNAL('clicked()'), self.close) self._reload_themes()
def __init__(self, suggested, parent=None): super(PythonDetectDialog, self).__init__(parent, Qt.Dialog) self.setMaximumSize(QSize(0, 0)) self.setWindowTitle("Configure Python Path") vbox = QVBoxLayout(self) msg_str = ("We have detected that you are using " "Windows,\nplease choose the proper " "Python application for you:") lblMessage = QLabel(self.tr(msg_str)) vbox.addWidget(lblMessage) self.listPaths = QListWidget() self.listPaths.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.listPaths) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btnCancel = QPushButton(self.tr("Cancel")) btnAccept = QPushButton(self.tr("Accept")) hbox.addWidget(btnCancel) hbox.addWidget(btnAccept) vbox.addLayout(hbox) self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path) self.connect(btnCancel, SIGNAL("clicked()"), self.close) for path in suggested: self.listPaths.addItem(path) self.listPaths.setCurrentRow(0)
def __init__(self): QDialog.__init__(self) self.setWindowTitle(translations.TR_PLUGIN_ERROR_REPORT) self.resize(600, 400) vbox = QVBoxLayout(self) label = QLabel(translations.TR_SOME_PLUGINS_REMOVED) vbox.addWidget(label) self._tabs = QTabWidget() vbox.addWidget(self._tabs) hbox = QHBoxLayout() btnAccept = QPushButton(translations.TR_ACCEPT) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) #signals self.connect(btnAccept, SIGNAL("clicked()"), self.close)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(translations.TR_PLUGIN_MANAGER) self.resize(700, 600) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) self._txt_data = QTextBrowser() self._txt_data.setOpenLinks(False) vbox.addWidget(QLabel(translations.TR_PROJECT_DESCRIPTION)) vbox.addWidget(self._txt_data) # Footer hbox = QHBoxLayout() btn_close = QPushButton(translations.TR_CLOSE) btnReload = QPushButton(translations.TR_RELOAD) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.hide() self._oficial_available = [] self._community_available = [] self._locals = [] self._updates = [] self._loading = True self._requirements = {} self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins) self.thread = ThreadLoadPlugins(self) self.connect(self.thread, SIGNAL("finished()"), self._load_plugins_data) self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"), self._after_download_plugin) self.connect(self.thread, SIGNAL("plugin_manually_installed(PyQt_PyObject)"), self._after_manual_install_plugin) self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"), self._after_uninstall_plugin) self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"), self._open_link) self.connect(btn_close, SIGNAL('clicked()'), self.close) self.overlay.show() self._reload_plugins()
def __init__(self, parent): super(ThemeEditor, self).__init__(parent, Qt.Dialog) vbox = QVBoxLayout(self) hbox = QHBoxLayout() self.line_name = QLineEdit() self.btn_save = QPushButton(translations.TR_SAVE) self.line_name.setPlaceholderText(getuser().capitalize() + "s_theme") hbox.addWidget(self.line_name) hbox.addWidget(self.btn_save) self.edit_qss = QPlainTextEdit() css = 'QPlainTextEdit {color: %s; background-color: %s;' \ 'selection-color: %s; selection-background-color: %s;}' \ % (resources.CUSTOM_SCHEME.get( 'editor-text', resources.COLOR_SCHEME['Default']), resources.CUSTOM_SCHEME.get( 'EditorBackground', resources.COLOR_SCHEME['EditorBackground']), resources.CUSTOM_SCHEME.get( 'EditorSelectionColor', resources.COLOR_SCHEME['EditorSelectionColor']), resources.CUSTOM_SCHEME.get( 'EditorSelectionBackground', resources.COLOR_SCHEME['EditorSelectionBackground'])) self.edit_qss.setStyleSheet(css) self.btn_apply = QPushButton(self.tr("Apply Style Sheet")) hbox2 = QHBoxLayout() hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(self.btn_apply) hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) vbox.addWidget(self.edit_qss) vbox.addLayout(hbox) vbox.addLayout(hbox2) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_stylesheet) self.connect(self.btn_save, SIGNAL("clicked()"), self.save_stylesheet)
def __init__(self, requirements_dict): super(DependenciesHelpDialog, self).__init__() self.setWindowTitle(translations.TR_REQUIREMENTS) self.resize(525, 400) vbox = QVBoxLayout(self) label = QLabel(translations.TR_SOME_PLUGINS_NEED_DEPENDENCIES) vbox.addWidget(label) self._editor = QPlainTextEdit() self._editor.setReadOnly(True) vbox.addWidget(self._editor) hbox = QHBoxLayout() btnAccept = QPushButton(translations.TR_ACCEPT) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) #signals self.connect(btnAccept, SIGNAL("clicked()"), self.close) command_tmpl = "<%s>:\n%s\n" for name, description in list(requirements_dict.items()): self._editor.insertPlainText(command_tmpl % (name, description))
def __init__(self, parent): super(ShortcutDialog, self).__init__() self.keys = 0 #Keyword modifiers! self.keyword_modifiers = (Qt.Key_Control, Qt.Key_Meta, Qt.Key_Shift, Qt.Key_Alt, Qt.Key_Menu) #main layout main_vbox = QVBoxLayout(self) self.line_edit = QLineEdit() self.line_edit.setReadOnly(True) #layout for buttons buttons_layout = QHBoxLayout() ok_button = QPushButton(translations.TR_ACCEPT) cancel_button = QPushButton(translations.TR_CANCEL) #add widgets main_vbox.addWidget(self.line_edit) buttons_layout.addWidget(ok_button) buttons_layout.addWidget(cancel_button) main_vbox.addLayout(buttons_layout) self.line_edit.installEventFilter(self) #buttons signals self.connect(ok_button, SIGNAL("clicked()"), self.save_shortcut) self.connect(cancel_button, SIGNAL("clicked()"), self.close)
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtName.setPlaceholderText('my_plugin') self._txtVersion = QLineEdit() self._txtVersion.setPlaceholderText('0.1') form.addRow(translations.TR_PROJECT_NAME, self._txtName) form.addRow(translations.TR_VERSION, self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._txtFilePath.setPlaceholderText( os.path.join(os.path.expanduser('~'), 'full', 'path', 'to', 'plugin.zip')) self._btnFilePath = QPushButton(QIcon(":img/open"), '') self.completer, self.dirs = QCompleter(self), QDirModel(self) self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot) self.completer.setModel(self.dirs) self._txtFilePath.setCompleter(self.completer) hPath.addWidget(QLabel(translations.TR_FILENAME)) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem( QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(translations.TR_INSTALL) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, parent): super(ShortcutConfiguration, self).__init__() self._preferences = parent self.shortcuts_text = { "Show-Selector": translations.TR_SHOW_SELECTOR, "cut": translations.TR_CUT, "Indent-more": translations.TR_INDENT_MORE, "expand-file-combo": translations.TR_EXPAND_FILE_COMBO, "expand-symbol-combo": translations.TR_EXPAND_SYMBOL_COMBO, "undo": translations.TR_UNDO, "Close-Split": translations.TR_CLOSE_SPLIT, "Split-assistance": translations.TR_SHOW_SPLIT_ASSISTANCE, "copy": translations.TR_COPY, "paste": translations.TR_PASTE, "Duplicate": translations.TR_DUPLICATE_SELECTION, "Remove-line": translations.TR_REMOVE_LINE_SELECTION, "Move-up": translations.TR_MOVE_LINE_SELECTION_UP, "Move-down": translations.TR_MOVE_LINE_SELECTION_DOWN, "Close-file": translations.TR_CLOSE_CURRENT_TAB, "New-file": translations.TR_NEW_TAB, "New-project": translations.TR_NEW_PROJECT, "Open-file": translations.TR_OPEN_A_FILE, "Open-project": translations.TR_OPEN_PROJECT, "Save-file": translations.TR_SAVE_FILE, "Save-project": translations.TR_SAVE_OPENED_FILES, "Print-file": translations.TR_PRINT_FILE, "Redo": translations.TR_REDO, "Comment": translations.TR_COMMENT_SELECTION, "Uncomment": translations.TR_UNCOMMENT_SELECTION, "Horizontal-line": translations.TR_INSERT_HORIZONTAL_LINE, "Title-comment": translations.TR_INSERT_TITLE_COMMENT, "Indent-less": translations.TR_INDENT_LESS, "Hide-misc": translations.TR_HIDE_MISC, "Hide-editor": translations.TR_HIDE_EDITOR, "Hide-explorer": translations.TR_HIDE_EXPLORER, "Toggle-tabs-spaces": translations.TR_TOGGLE_TABS, "Run-file": translations.TR_RUN_FILE, "Run-project": translations.TR_RUN_PROJECT, "Debug": translations.TR_DEBUG, "Switch-Focus": translations.TR_SWITCH_FOCUS, "Stop-execution": translations.TR_STOP_EXECUTION, "Hide-all": translations.TR_HIDE_ALL, "Full-screen": translations.TR_FULLSCREEN, "Find": translations.TR_FIND, "Find-replace": translations.TR_FIND_REPLACE, "Find-with-word": translations.TR_FIND_WORD_UNDER_CURSOR, "Find-next": translations.TR_FIND_NEXT, "Find-previous": translations.TR_FIND_PREVIOUS, "Help": translations.TR_SHOW_PYTHON_HELP, "Split-vertical": translations.TR_SPLIT_TABS_VERTICAL, "Split-horizontal": translations.TR_SPLIT_TABS_HORIZONTAL, "Follow-mode": translations.TR_ACTIVATE_FOLLOW_MODE, "Reload-file": translations.TR_RELOAD_FILE, "Jump": translations.TR_JUMP_TO_LINE, "Find-in-files": translations.TR_FIND_IN_FILES, "Import": translations.TR_IMPORT_FROM_EVERYWHERE, "Go-to-definition": translations.TR_GO_TO_DEFINITION, "Complete-Declarations": translations.TR_COMPLETE_DECLARATIONS, "Code-locator": translations.TR_SHOW_CODE_LOCATOR, "File-Opener": translations.TR_SHOW_FILE_OPENER, "Navigate-back": translations.TR_NAVIGATE_BACK, "Navigate-forward": translations.TR_NAVIGATE_FORWARD, "Open-recent-closed": translations.TR_OPEN_RECENT_CLOSED_FILE, "Change-Tab": translations.TR_CHANGE_TO_NEXT_TAB, "Change-Tab-Reverse": translations.TR_CHANGE_TO_PREVIOUS_TAB, "Move-Tab-to-right": translations.TR_MOVE_TAB_TO_RIGHT, "Move-Tab-to-left": translations.TR_MOVE_TAB_TO_LEFT, "Show-Code-Nav": translations.TR_ACTIVATE_HISTORY_NAVIGATION, "Show-Bookmarks-Nav": translations.TR_ACTIVATE_BOOKMARKS_NAVIGATION, "Show-Breakpoints-Nav": translations.TR_ACTIVATE_BREAKPOINTS_NAVIGATION, "Show-Paste-History": translations.TR_SHOW_COPYPASTE_HISTORY, "History-Copy": translations.TR_COPY_TO_HISTORY, "History-Paste": translations.TR_PASTE_FROM_HISTORY, #"change-split-focus": #translations.TR_CHANGE_KEYBOARD_FOCUS_BETWEEN_SPLITS, "Add-Bookmark-or-Breakpoint": translations.TR_INSERT_BREAKPOINT, "move-tab-to-next-split": translations.TR_MOVE_TAB_TO_NEXT_SPLIT, "change-tab-visibility": translations.TR_SHOW_TABS_IN_EDITOR, "Highlight-Word": translations.TR_HIGHLIGHT_OCCURRENCES } self.shortcut_dialog = ShortcutDialog(self) #main layout main_vbox = QVBoxLayout(self) #layout for buttons buttons_layout = QVBoxLayout() #widgets self.result_widget = TreeResult() load_defaults_button = QPushButton(translations.TR_LOAD_DEFAULTS) #add widgets main_vbox.addWidget(self.result_widget) buttons_layout.addWidget(load_defaults_button) main_vbox.addLayout(buttons_layout) main_vbox.addWidget( QLabel(translations.TR_SHORTCUTS_ARE_GOING_TO_BE_REFRESH)) #load data! self.result_widget.setColumnWidth(0, 400) self._load_shortcuts() #signals #open the set shortcut dialog self.connect(self.result_widget, SIGNAL("itemDoubleClicked(QTreeWidgetItem*, int)"), self._open_shortcut_dialog) #load defaults shortcuts self.connect(load_defaults_button, SIGNAL("clicked()"), self._load_defaults_shortcuts) #one shortcut has changed self.connect(self.shortcut_dialog, SIGNAL('shortcutChanged'), self._shortcut_changed) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) self.resize(1920, 1080) self.status = False self.setAutoFillBackground(False) self.setDocumentMode(False) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.exitAct = QAction(QIcon('exit.png'), '&Exit', self) self.exitAct.setShortcut('Ctrl+Q') self.exitAct.setStatusTip('Exit application') self.exitAct.triggered.connect(qApp.quit) self.loadAct = QAction(QIcon('exit.png'), '&Import Unfolding', self) self.loadAct.setShortcut('Ctrl+L') self.loadAct.setStatusTip('Import Unfolding') self.loadAct.triggered.connect(self.openFileNameDialog) self.exportAct = QAction(QIcon('exit.png'), '&Export Unfolding', self) self.exportAct.setShortcut('Ctrl+E') self.exportAct.setStatusTip('Export Unfolding') self.exportAct.triggered.connect(self.exportUnfolding) self.writeNPAct = QAction(QIcon('exit.png'), '&Write coordinates as np file', self) self.writeNPAct.setShortcut('Ctrl+W') self.writeNPAct.setStatusTip('Write coordinates') self.writeNPAct.triggered.connect(self.writeNP_file) self.loadGeometryAct = QAction(QIcon('exit.png'), '&Load geometry from .log file', self) #self.loadGeometry.setShortcut('Ctrl+W') self.loadGeometryAct.setStatusTip('Load geometry') self.loadGeometryAct.triggered.connect(self.loadGeometry) self.select_directoryAct = QAction( QIcon('exit.png'), '&Select a directory to generate hdf5 files from', self) self.select_directoryAct.setStatusTip('Select directory') self.select_directoryAct.triggered.connect(self.select_directory) self.load_HDF5Act = QAction(QIcon('exit.png'), '&Select a hdf5 files for the DFT data', self) self.load_HDF5Act.setStatusTip('Select HDF5') self.load_HDF5Act.triggered.connect(self.load_hdf5_scan) self.statusBar() self.menubar = self.menuBar() self.fileMenu = self.menubar.addMenu('&File') self.fileMenu.addAction(self.exitAct) self.fileMenu.addAction(self.loadAct) self.fileMenu.addAction(self.exportAct) self.fileMenu.addAction(self.writeNPAct) self.fileMenu.addAction(self.loadGeometryAct) self.fileMenu.addAction(self.select_directoryAct) self.fileMenu.addAction(self.load_HDF5Act) self.horizontalLayout = QHBoxLayout(self.centralwidget) self.horizontalLayout.setSpacing(10) self.verticalLayout = QVBoxLayout() ### Containing the integration buttons self.horizontalLayout_2 = QHBoxLayout() ### Containing the inital/final position show self.finalPositionLayout = QHBoxLayout() self.gl_widget = gl.GLViewWidget() self.gl_widget.setCameraPosition(distance=20, elevation=40) self.gl_widget.setGeometry(0, 110, 1920, 1080) self.energy_Plot = PlotWidget() self.energy_Plot.setObjectName(_fromUtf8("energyPlot")) self.energy_Plot.setBackground('k') # set properties of the label for y axis self.energy_Plot.setLabel('left', 'E(B3LYP)', units='H') # set properties of the label for x axis self.energy_Plot.setLabel('bottom', 'CC-distance', units='A') # adding legend self.energy_Plot.addLegend() self.horizontalLayout.addWidget(self.gl_widget, 4) ### Push button for sinle integration self.btnUp = QPushButton() self.btnUp.setObjectName(_fromUtf8("btnUp")) ### Check box for continous integration self.chkIntegrate = QCheckBox() self.chkIntegrate.setObjectName(_fromUtf8("chkIntegrate")) ### SpinBox to set the size of the integration step self.spinStep = QSpinBox() self.spinStep.setMinimum(0) self.spinStep.setMaximum(10000) self.spinStep.setObjectName(_fromUtf8("spinStep")) ### final position button self.btnFin = QPushButton() self.btnFin.setObjectName(_fromUtf8("btnFin")) ### initial position button self.btnInit = QPushButton() self.btnInit.setObjectName(_fromUtf8("btnPos")) ### select hinges button self.btnSelHinge = QPushButton() self.btnSelHinge.setObjectName(_fromUtf8("btnSelHinge")) ### close unfolding button self.btnClose = QPushButton() self.btnClose.setObjectName(_fromUtf8("btnClose")) ### add the buttons to the integration layout self.horizontalLayout_2.addWidget(self.spinStep) self.horizontalLayout_2.addWidget(self.btnUp) self.horizontalLayout_2.addWidget(self.chkIntegrate) ## add final position button to layout self.finalPositionLayout.addWidget(self.btnInit) self.finalPositionLayout.addWidget(self.btnFin) self.finalPositionLayout.addWidget(self.btnSelHinge) self.finalPositionLayout.addWidget(self.btnClose) ### add integration and final position layout and plot widget to right side layout self.verticalLayout.addLayout(self.horizontalLayout_2, 1) self.verticalLayout.addLayout(self.finalPositionLayout, 1) self.verticalLayout.addWidget(self.energy_Plot, 6) self.horizontalLayout.addLayout(self.verticalLayout, 1) self.widget = QWidget() self.widget.setLayout(self.horizontalLayout) self.setCentralWidget(self.widget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.setWindowTitle('Fullerene Unfolding') def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) self.btnUp.setText("Integrate") self.chkIntegrate.setText("Keep integrating") self.btnFin.setText("Final position") self.btnInit.setText("Initial position") self.btnClose.setText("Close unfolding") self.btnSelHinge.setText("Select Hinges")