Exemplo n.º 1
0
 def refresh_view(self):
     """Apply the configured font and update widgets."""
     # The fixed-width console font
     qtutils.set_diff_font(self.view.global_cola_fontdiff)
     # Label the group box around the local repository
     self.view.local_groupbox.setTitle(unicode(self.tr('%s Repository'))
                                       % self.model.project)
     QObserver.refresh_view(self)
Exemplo n.º 2
0
    def __init__(self,
                 parent=None,
                 title=None,
                 multiselect=True,
                 syntax=True):
        QtGui.QDialog.__init__(self, parent)
        if title:
            self.setWindowTitle(title)

        # Allow disabling multi-select
        self.resize(700, 420)
        self.setObjectName('commit')

        self.vboxlayout = QtGui.QVBoxLayout(self)
        self.vboxlayout.setObjectName('vboxlayout')

        self.splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setHandleWidth(2)
        self.splitter.setObjectName('splitter')

        self.commit_list = QtGui.QListWidget(self.splitter)
        self.commit_list.setObjectName('commit_list')
        self.commit_list.setAlternatingRowColors(True)
        if multiselect:
            mode = QtGui.QAbstractItemView.ExtendedSelection
        else:
            mode = QtGui.QAbstractItemView.SingleSelection
        self.commit_list.setSelectionMode(mode)

        self.commit_text = QtGui.QTextEdit(self.splitter)
        self.commit_text.setMinimumSize(QtCore.QSize(0, 40))
        self.commit_text.setTabChangesFocus(True)
        self.commit_text.setUndoRedoEnabled(False)
        self.commit_text.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.commit_text.setReadOnly(True)
        self.commit_text.setObjectName('commit_text')

        self.vboxlayout.addWidget(self.splitter)
        self.hboxlayout = QtGui.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")

        self.label = QtGui.QLabel(self)
        self.label.setObjectName('label')
        self.label.setText(self.tr('Revision Expression:'))

        self.hboxlayout.addWidget(self.label)

        self.revision = QtGui.QLineEdit(self)
        self.revision.setObjectName('revision')

        self.hboxlayout.addWidget(self.revision)
        self.vboxlayout.addLayout(self.hboxlayout)

        self.button_box = QtGui.QDialogButtonBox(self)
        self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
                                           QtGui.QDialogButtonBox.Ok)
        self.button_box.setObjectName('button_box')
        self.vboxlayout.addWidget(self.button_box)

        self.connect(self.button_box, SIGNAL('accepted()'), self.accept)
        self.connect(self.button_box, SIGNAL('rejected()'), self.reject)

        self.setTabOrder(self.button_box, self.commit_list)
        self.setTabOrder(self.commit_list, self.revision)
        self.setTabOrder(self.revision, self.commit_text)

        # Make the list widget slighty larger
        self.splitter.setSizes([100, 150])
        self.syntax = DiffSyntaxHighlighter(self.commit_text.document(),
                                            whitespace=False)

        # Set the console font
        if syntax:
            qtutils.set_diff_font(self.commit_text)
Exemplo n.º 3
0
 def update_diff_font(self):
     """Updates the diff font based on the configured value."""
     qtutils.set_diff_font(qtutils.logger())
     qtutils.set_diff_font(self.view.display_text)
     qtutils.set_diff_font(self.view.commitmsg)
Exemplo n.º 4
0
    def __init__(self, parent=None):
        standard.StandardDialog.__init__(self, parent=parent)

        self.setWindowTitle(self.tr('Search'))
        if self.parent():
            self.resize(600, self.parent().height())
        else:
            self.resize(600, 500)

        self._main_vbox_layt = QtGui.QVBoxLayout(self)
        self._top_grid_layt = QtGui.QGridLayout()
        # Exposed
        self.radio_range = QtGui.QRadioButton(self)
        self.radio_range.setText(self.tr('Revision Range Expression'))
        self._top_grid_layt.addWidget(self.radio_range, 0, 0, 1, 2)
        # Exposed
        self.radio_path = QtGui.QRadioButton(self)
        self.radio_path.setText(self.tr('Commits Touching Paths'))
        self._top_grid_layt.addWidget(self.radio_path, 0, 2, 1, 1)
        # Exposed
        self.radio_author = QtGui.QRadioButton(self)
        self.radio_author.setText(self.tr('Author'))
        self._top_grid_layt.addWidget(self.radio_author, 0, 3, 1, 1)
        # Exposed
        self.radio_committer = QtGui.QRadioButton(self)
        self.radio_committer.setText(self.tr('Committer'))
        self._top_grid_layt.addWidget(self.radio_committer, 0, 4, 1, 1)
        # Exposed
        self.radio_revision = QtGui.QRadioButton(self)
        self.radio_revision.setText(self.tr('Revision ID'))
        self._top_grid_layt.addWidget(self.radio_revision, 1, 0, 1, 2)
        # Exposed
        self.radio_message = QtGui.QRadioButton(self)
        self.radio_message.setText(self.tr('Commit Messages'))
        self._top_grid_layt.addWidget(self.radio_message, 1, 2, 1, 1)
        # Exposed
        self.radio_daterange = QtGui.QRadioButton(self)
        self.radio_daterange.setText(self.tr('Date Range (Start / End)'))
        self._top_grid_layt.addWidget(self.radio_daterange, 1, 3, 1, 2)
        # Exposed
        self.maxresults_label = QtGui.QLabel(self)
        self.maxresults_label.setText(self.tr('Max Results'))
        self._top_grid_layt.addWidget(self.maxresults_label, 2, 0, 1, 1)
        # Exposed
        self.max_results = QtGui.QSpinBox(self)
        self.max_results.setMinimum(5)
        self.max_results.setMaximum(9995)
        self.max_results.setSingleStep(5)
        self.max_results.setProperty("value", QtCore.QVariant(500))
        self._top_grid_layt.addWidget(self.max_results, 2, 1, 1, 1)
        # Exposed
        self.radio_diff = QtGui.QRadioButton(self)
        self.radio_diff.setText(self.tr('Diff Content'))
        self._top_grid_layt.addWidget(self.radio_diff, 2, 2, 1, 1)
        # Exposed
        self.start_date = QtGui.QDateEdit(self)
        self.start_date.setCurrentSection(QtGui.QDateTimeEdit.YearSection)
        self.start_date.setCalendarPopup(True)
        self.start_date.setDisplayFormat(self.tr('yyyy-MM-dd'))
        self._top_grid_layt.addWidget(self.start_date, 2, 3, 1, 1)
        # Exposed
        self.end_date = QtGui.QDateEdit(self)
        self.end_date.setCurrentSection(QtGui.QDateTimeEdit.YearSection)
        self.end_date.setCalendarPopup(True)
        self.end_date.setDisplayFormat(self.tr('yyyy-MM-dd'))
        self._top_grid_layt.addWidget(self.end_date, 2, 4, 1, 1)
        # Exposed
        self.button_search = QtGui.QPushButton(self)
        self.button_search.setText(self.tr('Search'))
        self.button_search.setShortcut(self.tr('Return'))
        self._top_grid_layt.addWidget(self.button_search, 3, 0, 1, 1)
        # Exposed
        self.query = QtGui.QLineEdit(self)
        self.query.setFocus()
        self._top_grid_layt.addWidget(self.query, 3, 1, 1, 3)
        # Exposed
        self.button_browse = QtGui.QPushButton(self)
        self.button_browse.setText(self.tr('Browse'))
        self._top_grid_layt.addWidget(self.button_browse, 3, 4, 1, 1)
        self._main_vbox_layt.addLayout(self._top_grid_layt)
        # Exposed
        self.splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setHandleWidth(2)
        # Exposed
        self.commit_list = QtGui.QListWidget(self.splitter)
        self.commit_list.setMinimumSize(QtCore.QSize(1, 1))
        self.commit_list.setAlternatingRowColors(True)
        self.commit_list.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        # Exposed
        self.commit_text = QtGui.QTextEdit(self.splitter)
        self.commit_text.setMinimumSize(QtCore.QSize(1, 1))
        self.commit_text.setTabChangesFocus(True)
        self.commit_text.setReadOnly(True)
        self.commit_text.setAcceptRichText(False)
        qtutils.set_diff_font(self.commit_text)
        self._syntax = syntax.DiffSyntaxHighlighter(self.commit_text.document(),
                                                    whitespace=False)
        self._main_vbox_layt.addWidget(self.splitter)

        self._button_grid_layt = QtGui.QGridLayout()
        # Exposed
        self.button_export = QtGui.QPushButton(self)
        self.button_export.setText(self.tr('Export Patches'))
        self._button_grid_layt.addWidget(self.button_export, 0, 0, 1, 1)
        # Exposed
        self.button_cherrypick = QtGui.QPushButton(self)
        self.button_cherrypick.setText(self.tr('Cherry Pick'))
        self._button_grid_layt.addWidget(self.button_cherrypick, 0, 1, 1, 1)
        # Exposed
        self._button_spacer = QtGui.QSpacerItem(111, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self._button_grid_layt.addItem(self._button_spacer, 0, 2, 1, 1)
        # Exposed
        self.button_close = QtGui.QPushButton(self)
        self.button_close.setText(self.tr('Close'))
        self._button_grid_layt.addWidget(self.button_close, 0, 3, 1, 1)
        self._main_vbox_layt.addLayout(self._button_grid_layt)

        self.connect(self.button_close, SIGNAL('clicked()'), self.accept)
Exemplo n.º 5
0
    def __init__(self, parent=None):
        standard.StandardDialog.__init__(self, parent=parent)
        self.setWindowTitle(self.tr("Create Tag"))
        self.resize(506, 295)
        self._main_layt = QtGui.QVBoxLayout(self)

        # Form layout for inputs
        self._input_form_layt = QtGui.QFormLayout()
        self._input_form_layt.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)

        # Tag label
        self._tag_name_label = QtGui.QLabel(self)
        self._tag_name_label.setText(self.tr("Name"))
        self._input_form_layt.setWidget(0, QtGui.QFormLayout.LabelRole, self._tag_name_label)

        self.tag_name = QtGui.QLineEdit(self)
        self.tag_name.setToolTip(self.tr("Specifies the tag name"))
        self._input_form_layt.setWidget(0, QtGui.QFormLayout.FieldRole, self.tag_name)

        # Sign Tag
        self._sign_label = QtGui.QLabel(self)
        self._sign_label.setText(self.tr("Sign Tag"))
        self._input_form_layt.setWidget(1, QtGui.QFormLayout.LabelRole, self._sign_label)

        self.sign_tag = QtGui.QCheckBox(self)
        self.sign_tag.setToolTip(self.tr("Whether to sign the tag (git tag -s)"))
        self._input_form_layt.setWidget(1, QtGui.QFormLayout.FieldRole, self.sign_tag)
        self._main_layt.addLayout(self._input_form_layt)

        # Tag message
        self._tag_msg_label = QtGui.QLabel(self)
        self._tag_msg_label.setText(self.tr("Message"))
        self._input_form_layt.setWidget(2, QtGui.QFormLayout.LabelRole, self._tag_msg_label)
        # Exposed
        self.tag_msg = QtGui.QTextEdit(self)
        self.tag_msg.setAcceptRichText(False)
        self.tag_msg.setToolTip(self.tr("Specifies the tag message"))
        self._input_form_layt.setWidget(2, QtGui.QFormLayout.FieldRole, self.tag_msg)
        # Revision
        self._rev_label = QtGui.QLabel(self)
        self._rev_label.setText(self.tr("Revision"))
        self._input_form_layt.setWidget(3, QtGui.QFormLayout.LabelRole, self._rev_label)
        # Exposed
        self.revision = QtGui.QComboBox(self)
        self.revision.setEditable(True)
        self.revision.setToolTip(self.tr("Specifies the SHA-1 to tag"))
        self._input_form_layt.setWidget(3, QtGui.QFormLayout.FieldRole, self.revision)

        # Buttons
        self._button_hbox_layt = QtGui.QHBoxLayout()
        self._button_spacer = QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self._button_hbox_layt.addItem(self._button_spacer)

        self.create_button = QtGui.QPushButton(self)
        self.create_button.setText(self.tr("Create"))
        self._button_hbox_layt.addWidget(self.create_button)
        self._main_layt.addLayout(self._button_hbox_layt)

        self.close_button = QtGui.QPushButton(self)
        self.close_button.setText(self.tr("Close"))
        self._button_hbox_layt.addWidget(self.close_button)

        self.connect(self.sign_tag, SIGNAL("stateChanged(int)"), self.tag_msg.setEnabled)
        self.connect(self.close_button, SIGNAL("clicked()"), self.accept)

        qtutils.set_diff_font(self.tag_msg)
        self.tag_msg.setEnabled(False)