예제 #1
0
 def __init__(self, parent=None):
     super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint)
     self._migration, vbox, hbox = {}, QVBoxLayout(self), QHBoxLayout()
     lbl_title = QLabel(translations.TR_CURRENT_CODE)
     lbl_suggestion = QLabel(translations.TR_SUGGESTED_CHANGES)
     self.current_list, self.suggestion = QListWidget(), QPlainTextEdit()
     self.suggestion.setReadOnly(True)
     self.btn_apply = QPushButton(translations.TR_APPLY_CHANGES + " !")
     self.suggestion.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
     self.btn_apply.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
     # pack up all widgets
     hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
     hbox.addWidget(self.btn_apply)
     vbox.addWidget(lbl_title)
     vbox.addWidget(self.current_list)
     vbox.addWidget(lbl_suggestion)
     vbox.addWidget(self.suggestion)
     vbox.addLayout(hbox)
     # connections
     self.connect(self.current_list,
                  SIGNAL("itemClicked(QListWidgetItem*)"),
                  self.load_suggestion)
     self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)
     # registers
     IDE.register_service('tab_migration', self)
     ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
class Form(QWidget):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        # self.le = QLabel()
        self.le = QLineEdit()
        self.le.setObjectName("Empty")
        self.le.setText("Empty")

        self.pb = QPushButton()
        self.pb.setObjectName("browse")
        self.pb.setText("Browse")

        layout = QHBoxLayout()
        layout.addWidget(self.le)
        layout.addWidget(self.pb)

        self.setLayout(layout)
        self.connect(self.pb, SIGNAL("clicked()"), self.button_click)
        self.setWindowTitle("Learning")

    def button_click(self):
        # absolute_path is a QString object
        absolute_path = QFileDialog.getOpenFileName(self, 'Open file', '.',
                                                    "txt files (*.txt)")
        if absolute_path:
            cur_path = QDir('.')
            relative_path = cur_path.relativeFilePath(absolute_path)
            self.le.setText(relative_path)
            print
            relative_path
예제 #3
0
    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)
예제 #4
0
파일: uimain.py 프로젝트: lycying/seeking
    def __init__(self, parent=None):
        QTabWidget.__init__(self, parent)
        self.setTabBar(TabBarSupport(self))
        self.setMovable(False)
        self.setTabsClosable(True)
        self.setDocumentMode(False)

        self.navigationButton = QPushButton(
            QIcon(getPath('iconDir', 'navigation.png')), "", self)
        self.navigationButton.setFlat(True)

        self.closeButton = QPushButton(
            QIcon(getPath('iconDir', 'navclose.png')), "", self)
        self.closeButton.setFlat(True)

        self.rightCornerWidget = QWidget(self)
        self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
        self.rightCornerWidgetLayout.setMargin(0)
        self.rightCornerWidgetLayout.setSpacing(0)
        self.rightCornerWidgetLayout.addWidget(self.navigationButton)
        self.rightCornerWidgetLayout.addWidget(self.closeButton)
        self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)

        QObject.connect(self.navigationButton, SIGNAL("pressed()"),
                        self.__evt_navigation)
        QObject.connect(
            self.closeButton, SIGNAL("clicked(bool)"), lambda: self.emit(
                SIGNAL("tabCloseRequested (int)"), self.currentIndex()))
        QObject.connect(self, SIGNAL("tabCloseRequested (int)"),
                        self.__evt_close_tab_click)
        QObject.connect(self.tabBar(),
                        SIGNAL('customContextMenuRequested(const QPoint &)'),
                        self.__evt_showContextMenu)
예제 #5
0
파일: uimain.py 프로젝트: lycying/seeking
 def __init__(self,parent=None):
     QTabWidget.__init__(self,parent)
     self.setTabBar(TabBarSupport(self))
     self.setMovable(False)
     self.setTabsClosable(True)
     self.setDocumentMode(False)
     
     
     self.navigationButton = QPushButton(QIcon(getPath('iconDir','navigation.png')),"",self)
     self.navigationButton.setFlat(True)
     
     self.closeButton = QPushButton(QIcon(getPath('iconDir','navclose.png')),"",self)
     self.closeButton.setFlat(True)
     
     self.rightCornerWidget = QWidget(self)
     self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
     self.rightCornerWidgetLayout.setMargin(0)
     self.rightCornerWidgetLayout.setSpacing(0)
     self.rightCornerWidgetLayout.addWidget(self.navigationButton)
     self.rightCornerWidgetLayout.addWidget(self.closeButton)
     self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)
     
     QObject.connect(self.navigationButton, SIGNAL("pressed()"),self.__evt_navigation)
     QObject.connect(self.closeButton, SIGNAL("clicked(bool)"),lambda:self.emit(SIGNAL("tabCloseRequested (int)"),self.currentIndex()))
     QObject.connect(self, SIGNAL("tabCloseRequested (int)"),self.__evt_close_tab_click)
     QObject.connect(self.tabBar(), SIGNAL('customContextMenuRequested(const QPoint &)'),self.__evt_showContextMenu)
예제 #6
0
    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()
예제 #7
0
    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)
예제 #8
0
    def show_initial_message(self):
        """Initial Message Prompts

        A series of initial messages displayed to the user in the Segmentation Popup Window
        """
        initial_message = QMessageBox()
        initial_message.setWindowTitle("Select Hardware Type")
        initial_message.setText(
            "What type of processor would you like to use?")
        initial_message.setInformativeText(
            "Running segmentation on a CPU takes around 3 hours. Running it on a GPU will take around 30 seconds."
        )
        initial_message.setIcon(QMessageBox.Question)
        initial_message.setDetailedText(
            "To perform the segmentation, Paint4Brain uses a convolutional neural network. This performs a lot faster on GPUs.\nIf you do not own a GPU, segmentation can also be run on a Google Colab GPU using the following link:\nhttps://tinyurl.com/Paint4Brains"
        )

        initial_message.addButton(QPushButton('CANCEL'),
                                  QMessageBox.RejectRole)
        initial_message.addButton(QPushButton('GPU'), QMessageBox.AcceptRole)
        initial_message.addButton(QPushButton('CPU'), QMessageBox.AcceptRole)

        initial_message.setDefaultButton(QPushButton('CPU'))
        initial_message.buttonClicked.connect(self.popup_button)
        initial_message.exec()
예제 #9
0
    def createToolbar(self):
        toolBar = QtGui.QToolBar('Model Settings')

        detailsButton = QPushButton("Detailed")
        detailsButton.clicked.connect(self.slot_showDetailedMorphology)

        propertyButton = QPushButton("Property")
        # propertyButton.clicked.connect(self._propertyTable.show)

        toolBar.addWidget(detailsButton)
        toolBar.addWidget(propertyButton)
        return toolBar
예제 #10
0
    def showdialog(self, title):
        d = QDialog(self)
        d.setFixedSize(300, 100)
        label = QLabel(self.Error, d)
        label.move(20, 20)
        self.current = os.listdir(self.files)[0][0:4]
        self.roll = QLineEdit(str(self.current), d)
        self.roll.move(50, 20)

        b1 = QPushButton("Ok",d)
        b1.move(125,50)
        d.setWindowTitle(str(title))

        b1.clicked.connect(self.process_frames)
        d.exec_()
예제 #11
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)
예제 #12
0
    def test_devel_vein_basin_segmentation(self):
        pth = r"E:\data\medical\processed\mik2018 para\P09_paraall_cropped.pklz"
        datap = io3d.read(pth)
        labels = {
            "1": 1,
            "2": 2,
            "3": 3,
            "4": 4,
            "5": 5,
            "6": 6,
        }
        from PyQt5.QtGui import QApplication, QPushButton
        app = QApplication(sys.argv)
        import seededitorqt


        se = seededitorqt.QTSeedEditor(datap["data3d"], contours=datap["segmentation"])

        def split(obj):
            import lisa.virtual_resection as vr


            print(np.max(datap["data3d"]))
            print(np.unique(se.seeds))
            out, sepobj = vr.split_vessel(datap, se.seeds, method="separate labels", input_seeds_label2=2)
            print(np.unique(out))
            se.seeds = out
            se.contours = out
            se.setView(se.actual_view)
        qpb = QPushButton("Ahoj")
        qpb.clicked.connect(split)
        wg = se.my_layout.layout().itemAt(0).itemAt(2).addWidget(qpb)

        se.exec_()
    def __init__(self, unfolding, parent=None):
        super(Window, self).__init__(parent)
        self.listCheckBox = []
        self.listLabel = []
        self.unfolding = unfolding

        for hinge in unfolding.all_hinges:
            self.listCheckBox.append(str(hinge))
            self.listLabel.append('')

        grid = QGridLayout()

        for i, v in enumerate(self.listCheckBox):
            self.listCheckBox[i] = QCheckBox(v)
            self.listLabel[i] = QLabel()
            grid.addWidget(self.listCheckBox[i], i, 0)
            grid.addWidget(self.listLabel[i], i, 1)
            if unfolding.all_hinges[i] in unfolding.open_hinges:
                self.listCheckBox[i].setChecked(True)
            else:
                self.listCheckBox[i].setChecked(False)

        self.button = QPushButton("Update hinges")
        self.button.clicked.connect(self.checkboxChanged)
        self.labelResult = QLabel()

        grid.addWidget(self.button, 10, 0, 1, 2)
        grid.addWidget(self.labelResult, 11, 0, 1, 2)
        self.setLayout(grid)
        self.setWindowTitle('Hinge Selection')
예제 #14
0
    def initUI(self):
        cw = QWidget()
        self.setCentralWidget(cw)
        grid = QGridLayout()
        grid.setSpacing(15)

        # status bar
        self.statusBar().showMessage('Ready')

        font_label = QFont()
        font_label.setBold(True)
        ################ dicom reader
        rstart = 0
        text_dcm = QLabel('DICOM reader')
        text_dcm.setFont(font_label)
        self.text_dcm_dir = QLabel('DICOM dir:')
        self.text_dcm_data = QLabel('DICOM data:')
        self.text_dcm_out = QLabel('output file:')
        grid.addWidget(text_dcm, rstart + 0, 1, 1, 4)
        grid.addWidget(self.text_dcm_dir, rstart + 1, 1, 1, 4)
        grid.addWidget(self.text_dcm_data, rstart + 2, 1, 1, 4)
        grid.addWidget(self.text_dcm_out, rstart + 3, 1, 1, 4)
        btn_dcmdir = QPushButton("Load DICOM", self)
        btn_dcmdir.clicked.connect(self.loadDcmDir)
        btn_dcmred = QPushButton("Organ Segmentation", self)
        btn_dcmred.clicked.connect(self.organSegmentation)
        btn_dcmcrop = QPushButton("Crop", self)
        btn_dcmcrop.clicked.connect(self.cropDcm)
        btn_dcmsave = QPushButton("Save DCM", self)
        btn_dcmsave.clicked.connect(self.saveDcm)
        grid.addWidget(btn_dcmdir, rstart + 4, 1)
        grid.addWidget(btn_dcmred, rstart + 4, 2)
        grid.addWidget(btn_dcmcrop, rstart + 4, 3)
        grid.addWidget(btn_dcmsave, rstart + 4, 4)

        hr = QFrame()
        hr.setFrameShape(QFrame.HLine)
        grid.addWidget(hr, rstart + 5, 0, 1, 6)

        # quit
        btn_quit = QPushButton("Quit", self)
        btn_quit.clicked.connect(self.quit)
        grid.addWidget(btn_quit, 24, 2, 1, 2)

        cw.setLayout(grid)
        self.setWindowTitle('liver-surgery')
        self.show()
예제 #15
0
파일: mshow.py 프로젝트: lycying/seeking
    def invoke(self):
        searchInput = QLineEdit()
        normalInput = QPlainTextEdit()
        normalInput.setMaximumHeight(100)
        searchBtn = QPushButton("Search")
        sayBtn = QPushButton("Hmm..")

        listTops = QWidget()

        layoutWidget = QGridLayout()
        layoutWidget.addWidget(searchInput, 1, 0)
        layoutWidget.addWidget(searchBtn, 1, 1)
        layoutWidget.addWidget(normalInput, 2, 0)
        layoutWidget.addWidget(sayBtn, 2, 1)
        layoutWidget.addWidget(listTops, 3, 0, 8, 1)

        self.setLayout(layoutWidget)
예제 #16
0
 def __init__(self, parent, schemes):
     QWidget.__init__(self, parent)
     self._parent = parent
     self._schemes = schemes
     vbox = QVBoxLayout(self)
     self._table = ui_tools.CheckableHeaderTable(1, 2)
     self._table.removeRow(0)
     vbox.addWidget(self._table)
     ui_tools.load_table(self._table,
                         [self.tr('Name'), self.tr('URL')], self._schemes)
     btnUninstall = QPushButton(self.tr('Download'))
     btnUninstall.setMaximumWidth(100)
     vbox.addWidget(btnUninstall)
     self._table.setColumnWidth(0, 200)
     self._table.setSortingEnabled(True)
     self._table.setAlternatingRowColors(True)
     self.connect(btnUninstall, SIGNAL("clicked()"), self._download_scheme)
예제 #17
0
    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=None):
        super(Form, self).__init__(parent)

        # self.le = QLabel()
        self.le = QLineEdit()
        self.le.setObjectName("Empty")
        self.le.setText("Empty")

        self.pb = QPushButton()
        self.pb.setObjectName("browse")
        self.pb.setText("Browse")

        layout = QHBoxLayout()
        layout.addWidget(self.le)
        layout.addWidget(self.pb)

        self.setLayout(layout)
        self.connect(self.pb, SIGNAL("clicked()"), self.button_click)
        self.setWindowTitle("Learning")
예제 #19
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        vbox = QVBoxLayout(self)
        self._webInspector = QWebInspector(self)
        vbox.addWidget(self._webInspector)
        self.btnDock = QPushButton(translations.TR_UNDOCK)
        vbox.addWidget(self.btnDock)

        ExplorerContainer.register_tab(translations.TR_TAB_WEB_INSPECTOR, self)
        IDE.register_service('web_inspector', self)
    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 add_item(self, key, scheme):
        """Take key and scheme arguments and fill up the grid with widgets."""
        row = self._grid.rowCount()
        self._grid.addWidget(QLabel(key), row, 0)
        isnum = isinstance(scheme[key], int)
        text = QLineEdit(str(scheme[key]))
        self._grid.addWidget(text, row, 1)
        if not isnum:
            btn = QPushButton()
            btn.setToolTip(translations.TR_EDITOR_SCHEME_PICK_COLOR)
            self.apply_button_style(btn, scheme[key])
            self._grid.addWidget(btn, row, 2)

            self.connect(text, SIGNAL("textChanged(QString)"),
                         lambda: self.apply_button_style(btn, text.text()))
            self.connect(btn, SIGNAL("clicked()"),
                         lambda: self._pick_color(text, btn))
        else:
            self.connect(text, SIGNAL("textChanged(QString)"),
                         self._preview_style)
        self._components[key] = (text, isnum)
예제 #22
0
    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))
예제 #23
0
    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, scheme, parent):
        super(EditorSchemeDesigner, self).__init__(parent, Qt.Dialog)
        self.original_style = copy.copy(resources.CUSTOM_SCHEME)
        self._avoid_on_loading, self.saved, self._components = True, False, {}
        self.setWindowTitle(translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER)
        self.setMinimumSize(450, 480)
        self.setMaximumSize(500, 900)
        self.resize(450, 600)

        # all layouts and groupboxes
        group0 = QGroupBox(translations.TR_PROJECT_NAME)  # scheme filename
        group1 = QGroupBox(translations.TR_PROJECT_PROPERTIES)  # properties
        group2 = QGroupBox(translations.TR_PREVIEW)  # quick preview thingy
        group0_hbox, group1_vbox = QHBoxLayout(group0), QVBoxLayout(group1)
        this_dialog_vbox, group2_vbox = QVBoxLayout(self), QVBoxLayout(group2)
        self._grid, scrollArea, frame = QGridLayout(), QScrollArea(), QFrame()

        # widgets
        self.line_name, btnSave = QLineEdit(), QPushButton(
            translations.TR_SAVE)
        self.line_name.setPlaceholderText(getuser().capitalize() + "s_scheme")
        group0_hbox.addWidget(self.line_name)
        group0_hbox.addWidget(btnSave)
        self.connect(btnSave, SIGNAL("clicked()"), self.save_scheme)
        _demo = "<center>" + ascii_letters  # demo text for preview
        self.preview_label1, self.preview_label2 = QLabel(_demo), QLabel(_demo)
        group2_vbox.addWidget(self.preview_label1)
        group2_vbox.addWidget(self.preview_label2)

        # rows titles
        self._grid.addWidget(QLabel("<b>" + translations.TR_PROJECT_NAME), 0,
                             0)
        self._grid.addWidget(QLabel("<b>" + translations.TR_CODE), 0, 1)
        self._grid.addWidget(
            QLabel("<b>" + translations.TR_EDITOR_SCHEME_PICK_COLOR), 0, 2)

        # fill rows
        for key in sorted(tuple(resources.COLOR_SCHEME.keys())):
            self.add_item(key, scheme)
        self.preview_label1.setStyleSheet('background:transparent')
        self.preview_label2.setStyleSheet('color:     transparent')

        # fill the scroll area
        frame.setLayout(self._grid)
        scrollArea.setWidget(frame)
        group1_vbox.addWidget(scrollArea)

        # put groups on the dialog
        this_dialog_vbox.addWidget(group1)
        this_dialog_vbox.addWidget(group2)
        this_dialog_vbox.addWidget(group0)
        self._avoid_on_loading = self._modified = False
예제 #25
0
    def initUI(self):

        grid = QGridLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self)
        grid.addWidget(self.vtkWidget, 0, 0, 1, 1)

        btn_close = QPushButton("close", self)
        btn_close.clicked.connect(self.close)
        grid.addWidget(btn_close, 1, 0, 1, 1)

        self.setLayout(grid)
        self.setWindowTitle('VTK Viewer')
        self.show()
예제 #26
0
    def __init__(self, parent, updates):
        QWidget.__init__(self, parent)
        self._parent = parent
        self._updates = updates
        vbox = QVBoxLayout(self)
        self._table = ui_tools.CheckableHeaderTable(1, 2)
        self._table.removeRow(0)
        self._table.setSelectionMode(QTableWidget.SingleSelection)
        self._table.setColumnWidth(0, 500)
        self._table.setSortingEnabled(True)
        self._table.setAlternatingRowColors(True)
        vbox.addWidget(self._table)
        ui_tools.load_table(
            self._table,
            (translations.TR_PROJECT_NAME, translations.TR_VERSION),
            _format_for_table(updates))
        btnUpdate = QPushButton(translations.TR_UPDATE)
        btnUpdate.setMaximumWidth(100)
        vbox.addWidget(btnUpdate)

        self.connect(btnUpdate, SIGNAL("clicked()"), self._update_plugins)
        self.connect(self._table, SIGNAL("itemSelectionChanged()"),
                     self._show_item_description)
예제 #27
0
 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)
예제 #28
0
    def __init__(self, parent):
        super(Theme, self).__init__()
        self._preferences, vbox = parent, QVBoxLayout(self)
        vbox.addWidget(QLabel(self.tr("<b>Select Theme:</b>")))
        self.list_skins = QListWidget()
        self.list_skins.setSelectionMode(QListWidget.SingleSelection)
        vbox.addWidget(self.list_skins)
        self.btn_delete = QPushButton(self.tr("Delete Theme"))
        self.btn_preview = QPushButton(self.tr("Preview Theme"))
        self.btn_create = QPushButton(self.tr("Create Theme"))
        hbox = QHBoxLayout()
        hbox.addWidget(self.btn_delete)
        hbox.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding,
                           QSizePolicy.Fixed))
        hbox.addWidget(self.btn_preview)
        hbox.addWidget(self.btn_create)
        vbox.addLayout(hbox)
        self._refresh_list()

        self.connect(self.btn_preview, SIGNAL("clicked()"), self.preview_theme)
        self.connect(self.btn_delete, SIGNAL("clicked()"), self.delete_theme)
        self.connect(self.btn_create, SIGNAL("clicked()"), self.create_theme)

        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
예제 #29
0
class MigrationWidget(QDialog):
    """2to3 Migration Assistance Widget Class"""
    def __init__(self, parent=None):
        super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint)
        self._migration, vbox, hbox = {}, QVBoxLayout(self), QHBoxLayout()
        lbl_title = QLabel(translations.TR_CURRENT_CODE)
        lbl_suggestion = QLabel(translations.TR_SUGGESTED_CHANGES)
        self.current_list, self.suggestion = QListWidget(), QPlainTextEdit()
        self.suggestion.setReadOnly(True)
        self.btn_apply = QPushButton(translations.TR_APPLY_CHANGES + " !")
        self.suggestion.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
        self.btn_apply.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
        # pack up all widgets
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(self.btn_apply)
        vbox.addWidget(lbl_title)
        vbox.addWidget(self.current_list)
        vbox.addWidget(lbl_suggestion)
        vbox.addWidget(self.suggestion)
        vbox.addLayout(hbox)
        # connections
        self.connect(self.current_list,
                     SIGNAL("itemClicked(QListWidgetItem*)"),
                     self.load_suggestion)
        self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)
        # registers
        IDE.register_service('tab_migration', self)
        ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)

    def install_tab(self):
        """Install the Tab on the IDE."""
        ide = IDE.get_service('ide')
        self.connect(ide, SIGNAL("goingDown()"), self.close)

    def apply_changes(self):
        """Apply the suggested changes on the Python code."""
        lineno = int(self.current_list.currentItem().data(Qt.UserRole))
        lines = self._migration[lineno][0].split('\n')
        remove, code = -1, ""
        for line in lines:
            if line.startswith('-'):
                remove += 1  # line to remove
            elif line.startswith('+'):
                code += '{line_to_add}\n'.format(line_to_add=line[1:])
        # get and apply changes on editor
        main_container = IDE.get_service('main_container')
        if main_container:
            editorWidget = main_container.get_current_editor()
            position = editorWidget.SendScintilla(
                editorWidget.SCI_POSITIONFROMLINE, lineno)
            curpos = editorWidget.SendScintilla(editorWidget.SCI_GETCURRENTPOS)
            if curpos != position:
                editorWidget.SendScintilla(editorWidget.SCI_GOTOPOS, position)
            endpos = editorWidget.SendScintilla(
                editorWidget.SCI_GETLINEENDPOSITION, lineno)
            editorWidget.SendScintilla(editorWidget.SCI_SETCURRENTPOS, endpos)
            editorWidget.replaceSelectedText(code[:-1])

    def load_suggestion(self, item):
        """Take an argument item and load the suggestion."""
        lineno, code = int(item.data(Qt.UserRole)), ""
        lines = self._migration[lineno][0].split('\n')
        for line in lines:
            if line.startswith('+'):
                code += '{line_to_add}\n'.format(line_to_add=line[1:])
        self.suggestion.setPlainText(code)
        main_container = IDE.get_service('main_container')
        if main_container:
            editorWidget = main_container.get_current_editor()
            if editorWidget:
                editorWidget.jump_to_line(lineno)
                editorWidget.setFocus()

    def refresh_lists(self, migration):
        """Refresh the list of code suggestions."""
        self._migration, base_lineno = migration, -1
        self.current_list.clear()
        for lineno in sorted(migration.keys()):
            linenostr = 'L{line_number}\n'.format(line_number=str(lineno + 1))
            data = migration[lineno]
            lines = data[0].split('\n')
            if base_lineno == data[1]:
                continue
            base_lineno = data[1]
            message = ''
            for line in lines:
                if line.startswith('-'):
                    message += '{line_to_load}\n'.format(line_to_load=line)
            item = QListWidgetItem(linenostr + message)
            item.setToolTip(linenostr + message)
            item.setData(Qt.UserRole, lineno)
            self.current_list.addItem(item)

    def clear(self):
        """Clear the widget."""
        self.current_list.clear()
        self.suggestion.clear()

    def reject(self):
        """Reject"""
        if self.parent() is None:
            self.emit(SIGNAL("dockWidget(PyQt_PyObject)"), self)

    def closeEvent(self, event):
        """Close"""
        self.emit(SIGNAL("dockWidget(PyQt_PyObject)"), self)
        event.ignore()
예제 #30
0
파일: uimain.py 프로젝트: lycying/seeking
class MainTabWidget(QTabWidget):
    """
    The main tabWidget
    """
    def __init__(self,parent=None):
        QTabWidget.__init__(self,parent)
        self.setTabBar(TabBarSupport(self))
        self.setMovable(False)
        self.setTabsClosable(True)
        self.setDocumentMode(False)
        
        
        self.navigationButton = QPushButton(QIcon(getPath('iconDir','navigation.png')),"",self)
        self.navigationButton.setFlat(True)
        
        self.closeButton = QPushButton(QIcon(getPath('iconDir','navclose.png')),"",self)
        self.closeButton.setFlat(True)
        
        self.rightCornerWidget = QWidget(self)
        self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
        self.rightCornerWidgetLayout.setMargin(0)
        self.rightCornerWidgetLayout.setSpacing(0)
        self.rightCornerWidgetLayout.addWidget(self.navigationButton)
        self.rightCornerWidgetLayout.addWidget(self.closeButton)
        self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)
        
        QObject.connect(self.navigationButton, SIGNAL("pressed()"),self.__evt_navigation)
        QObject.connect(self.closeButton, SIGNAL("clicked(bool)"),lambda:self.emit(SIGNAL("tabCloseRequested (int)"),self.currentIndex()))
        QObject.connect(self, SIGNAL("tabCloseRequested (int)"),self.__evt_close_tab_click)
        QObject.connect(self.tabBar(), SIGNAL('customContextMenuRequested(const QPoint &)'),self.__evt_showContextMenu)
        
    def __evt_contextMenuCloseOthers(self,index):
        """
        Private method to close the other tabs.
        """
        for i in range(self.count() - 1, index, -1) :
            self.__evt_close_tab_click(i)
        for i in range(index - 1, -1, -1):
            self.__evt_close_tab_click(i)
                
    def __evt_showContextMenu(self,point):
        _tabbar = self.tabBar()
        for index in range(_tabbar.count()):
            rect = _tabbar.tabRect(index)
            if rect.contains(point):
                menu = QMenu(self)
                action = QAction("close",self,triggered=lambda:self.__evt_close_tab_click(index))
                action.setEnabled(self.count()>1 and index is not 0)
                menu.addAction(action)
                
                action = QAction("close others",self,triggered=lambda:self.__evt_contextMenuCloseOthers(index))
                action.setEnabled(self.count()>1)
                menu.addAction(action)
                
                action = QAction("close all",self,triggered=lambda:self.__evt_contextMenuCloseOthers(0))
                action.setEnabled(self.count()>1)
                menu.addAction(action)
                
                menu.exec_(self.mapToGlobal(point))
    def __evt_navigation(self):
        menu = QMenu()
        actions = {}
        for i in range(self.count()):
            actions[i] = QAction(self.tabBar().tabIcon(i),self.tabBar().tabText(i),self,\
                            triggered=lambda re,i=i:self.setCurrentIndex(i) and self.navigationButton)
        for key in actions.keys():
            actions[key].setIconVisibleInMenu(True)
            menu.addAction(actions[key])
        self.navigationButton.setMenu(menu)
        self.navigationButton.showMenu()
        menu.clear()
    def __evt_close_tab_click(self,index):
        """
        because the first tab is the main window we'll show 
        so we never close it .
        If the tab's content need save , we also remind the user.
        """
        if 0 == index :return
        
        if hasattr(self.widget(index),"bufferon") and  self.widget(index).bufferon():
            
                reply = QMessageBox.question(self, "Save or not?",
                    "Save your content first?\n%s" % self.tabText(index),
                    QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
                if reply == QMessageBox.Yes:
                    if hasattr(self.widget(index),"save"):
                        self.widget(index).save()
                        self.removeTab(index)
                        Seeking().new().emit(SIGNAL('updateWindows()'))
                        return "yes"
                elif reply == QMessageBox.No:
                    self.removeTab(index)
                    Seeking().new().emit(SIGNAL('updateWindows()'))
                    return "no"
                elif reply == QMessageBox.Cancel:
                    return "cancel"
        else:
                self.removeTab(index)
                Seeking().new().emit(SIGNAL('updateWindows()'))
                return "yes"
예제 #31
0
파일: uimain.py 프로젝트: lycying/seeking
class MainTabWidget(QTabWidget):
    """
    The main tabWidget
    """
    def __init__(self, parent=None):
        QTabWidget.__init__(self, parent)
        self.setTabBar(TabBarSupport(self))
        self.setMovable(False)
        self.setTabsClosable(True)
        self.setDocumentMode(False)

        self.navigationButton = QPushButton(
            QIcon(getPath('iconDir', 'navigation.png')), "", self)
        self.navigationButton.setFlat(True)

        self.closeButton = QPushButton(
            QIcon(getPath('iconDir', 'navclose.png')), "", self)
        self.closeButton.setFlat(True)

        self.rightCornerWidget = QWidget(self)
        self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
        self.rightCornerWidgetLayout.setMargin(0)
        self.rightCornerWidgetLayout.setSpacing(0)
        self.rightCornerWidgetLayout.addWidget(self.navigationButton)
        self.rightCornerWidgetLayout.addWidget(self.closeButton)
        self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)

        QObject.connect(self.navigationButton, SIGNAL("pressed()"),
                        self.__evt_navigation)
        QObject.connect(
            self.closeButton, SIGNAL("clicked(bool)"), lambda: self.emit(
                SIGNAL("tabCloseRequested (int)"), self.currentIndex()))
        QObject.connect(self, SIGNAL("tabCloseRequested (int)"),
                        self.__evt_close_tab_click)
        QObject.connect(self.tabBar(),
                        SIGNAL('customContextMenuRequested(const QPoint &)'),
                        self.__evt_showContextMenu)

    def __evt_contextMenuCloseOthers(self, index):
        """
        Private method to close the other tabs.
        """
        for i in range(self.count() - 1, index, -1):
            self.__evt_close_tab_click(i)
        for i in range(index - 1, -1, -1):
            self.__evt_close_tab_click(i)

    def __evt_showContextMenu(self, point):
        _tabbar = self.tabBar()
        for index in range(_tabbar.count()):
            rect = _tabbar.tabRect(index)
            if rect.contains(point):
                menu = QMenu(self)
                action = QAction(
                    "close",
                    self,
                    triggered=lambda: self.__evt_close_tab_click(index))
                action.setEnabled(self.count() > 1 and index is not 0)
                menu.addAction(action)

                action = QAction(
                    "close others",
                    self,
                    triggered=lambda: self.__evt_contextMenuCloseOthers(index))
                action.setEnabled(self.count() > 1)
                menu.addAction(action)

                action = QAction(
                    "close all",
                    self,
                    triggered=lambda: self.__evt_contextMenuCloseOthers(0))
                action.setEnabled(self.count() > 1)
                menu.addAction(action)

                menu.exec_(self.mapToGlobal(point))

    def __evt_navigation(self):
        menu = QMenu()
        actions = {}
        for i in range(self.count()):
            actions[i] = QAction(self.tabBar().tabIcon(i),self.tabBar().tabText(i),self,\
                            triggered=lambda re,i=i:self.setCurrentIndex(i) and self.navigationButton)
        for key in actions.keys():
            actions[key].setIconVisibleInMenu(True)
            menu.addAction(actions[key])
        self.navigationButton.setMenu(menu)
        self.navigationButton.showMenu()
        menu.clear()

    def __evt_close_tab_click(self, index):
        """
        because the first tab is the main window we'll show 
        so we never close it .
        If the tab's content need save , we also remind the user.
        """
        if 0 == index: return

        if hasattr(self.widget(index),
                   "bufferon") and self.widget(index).bufferon():

            reply = QMessageBox.question(
                self, "Save or not?",
                "Save your content first?\n%s" % self.tabText(index),
                QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
            if reply == QMessageBox.Yes:
                if hasattr(self.widget(index), "save"):
                    self.widget(index).save()
                    self.removeTab(index)
                    Seeking().new().emit(SIGNAL('updateWindows()'))
                    return "yes"
            elif reply == QMessageBox.No:
                self.removeTab(index)
                Seeking().new().emit(SIGNAL('updateWindows()'))
                return "no"
            elif reply == QMessageBox.Cancel:
                return "cancel"
        else:
            self.removeTab(index)
            Seeking().new().emit(SIGNAL('updateWindows()'))
            return "yes"
예제 #32
0
    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)