def __init__(self, text1, text2, parent=None):
        BaseDialog.__init__(self, parent, remove_stretch=True)
        self.text1 = text1
        self.text2 = text2

        self.window_title = _("Diff Dialog")
        self.setWindowTitle(self.window_title)

        self.main_toolbar = QtGui.QToolBar()
        self.main_toolbar.setObjectName("Main Toolbar")
        self.main_toolbar.toggleViewAction().setText(_("Toolbar"))

        self.xml_editor1 = XMLEditor()
        self.xml_editor1.editor_settings()
        self.xml_editor1.setFolding(self.xml_editor1.BoxedFoldStyle)
        self.xml_editor1.setMarkerBackgroundColor(
            QtGui.QColor("#44ee44"), self.xml_editor1.MARKER_COLUMN)
        self.xml_editor1.setIndicatorForegroundColor(
            QtGui.QColor("#55ff55"), self.xml_editor1.highlight_index)

        self.xml_editor2 = XMLEditor()
        self.xml_editor2.editor_settings()
        self.xml_editor2.setFolding(self.xml_editor2.BoxedFoldStyle)
        self.xml_editor2.setIndicatorForegroundColor(
            QtGui.QColor("#ff5555"), self.xml_editor1.highlight_index)

        self.xml_editor1.verticalScrollBar().hide()
        self.xml_editor2.verticalScrollBar().valueChanged.connect(
            self.xml_editor1.verticalScrollBar().setValue)

        action_show_min_diffs = QtGui.QAction(_("Show Standard Diffs"), self)
        action_show_full_diffs = QtGui.QAction(_("Show Full Diffs"), self)

        icon = QtGui.QIcon.fromTheme("application-exit")
        action_quit = QtGui.QAction(icon, _("Quit"), self)

        self.main_toolbar.addAction(action_show_min_diffs)
        self.main_toolbar.addAction(action_show_full_diffs)
        self.main_toolbar.addAction(action_quit)

        splitter = QtGui.QSplitter()
        splitter.addWidget(self.xml_editor1)
        splitter.addWidget(self.xml_editor2)
        # splitter.setSizes([150, 650])

        self.insertWidget(self.main_toolbar)
        self.insertWidget(splitter)

        action_show_min_diffs.triggered.connect(self.load_diffs)
        action_show_full_diffs.triggered.connect(self.load_full_diffs)
        action_quit.triggered.connect(self.reject)

        self.load_diffs()
示例#2
0
    def load_feescales(self):
        self.loading = True
        self.text_editors = []
        self.feescale_parsers = OrderedDict()
        for ix, filepath in self.feescale_handler.local_files:
            fp = FeescaleParser(filepath, ix)
            try:
                fp.parse_file()
            except:
                message = u"%s '%s'" % (_("unable to parse file"), filepath)
                self.advise(message, 2)
                LOGGER.exception(message)

            editor = XMLEditor()
            editor.editor_settings()
            editor.textChanged.connect(self.text_changed)
            editor.editing_finished.connect(self.te_editing_finished)
            editor.cursorPositionChanged.connect(self.cursor_position_changed)

            title = fp.label_text
            self.feescale_parsers[title] = fp
            self.text_editors.append(editor)

            self.tab_widget.addTab(editor, title)

        self.loading = False
示例#3
0
    def load_feescale_from_filepath(self, ix, filepath):
        fp = FeescaleParser(filepath, ix)
        try:
            fp.parse_file()
        except:
            message = u"%s '%s'" % (_("unable to parse file"), filepath)
            self.advise(message, 2)
            LOGGER.exception(message)

        editor = XMLEditor()
        editor.editor_settings()
        editor.textChanged.connect(self.text_changed)
        editor.editing_finished.connect(self.te_editing_finished)
        editor.cursorPositionChanged.connect(self.cursor_position_changed)

        title = fp.label_text
        self.feescale_parsers[title] = fp
        self.text_editors.append(editor)

        self.tab_widget.addTab(editor, title)
        tooltip = "%s\n%s" % (fp.tablename, fp.description)
        LOGGER.debug("setting tab tool tip %s", tooltip.replace("\n", " "))
        self.tab_widget.setTabToolTip(ix, tooltip)