def __init__(self, parent, revs): QtGui.QWidget.__init__(self, parent) self._revs = revs self._revdict = dict(revs) self._rev_label = QtGui.QLabel() self._revision = completion.GitRefLineEdit() # Create the radio buttons radio_btns = [] self._radio_btns = {} for label, rev_list in self._revs: radio = qtutils.radio(text=label) radio.setObjectName(label) qtutils.connect_button(radio, self._set_revision_list) radio_btns.append(radio) self._radio_btns[label] = radio radio_btns.append(qtutils.STRETCH) self._rev_list = QtGui.QListWidget() label, rev_list = self._revs[0] self._radio_btns[label].setChecked(True) qtutils.set_items(self._rev_list, rev_list) self._rev_layt = qtutils.hbox(defs.no_margin, defs.spacing, self._rev_label, self._revision) self._radio_layt = qtutils.hbox(defs.margin, defs.spacing, *radio_btns) self._layt = qtutils.vbox(defs.no_margin, defs.spacing, self._rev_layt, self._radio_layt, self._rev_list) self.setLayout(self._layt) self.connect(self._rev_list, SIGNAL('itemSelectionChanged()'), self._rev_list_selection_changed)
def __init__(self, model, parent=None): Dialog.__init__(self, parent=parent) self.setAttribute(Qt.WA_MacMetalStyle) self.setWindowTitle(N_('Create Branch')) if parent is not None: self.setWindowModality(Qt.WindowModal) self.model = model self.opts = CreateOpts(model) self.thread = CreateThread(self.opts, self) self.progress = QtGui.QProgressDialog(self) self.progress.setRange(0, 0) self.progress.setCancelButton(None) self.progress.setWindowTitle(N_('Create Branch')) self.progress.setWindowModality(Qt.WindowModal) self.branch_name_label = QtGui.QLabel() self.branch_name_label.setText(N_('Branch Name')) self.branch_name = QtGui.QLineEdit() self.rev_label = QtGui.QLabel() self.rev_label.setText(N_('Starting Revision')) self.revision = completion.GitRefLineEdit() current = gitcmds.current_branch() if current: self.revision.setText(current) self.local_radio = qtutils.radio(text=N_('Local branch'), checked=True) self.remote_radio = qtutils.radio(text=N_('Tracking branch')) self.tag_radio = qtutils.radio(text=N_('Tag')) self.branch_list = QtGui.QListWidget() self.update_existing_label = QtGui.QLabel() self.update_existing_label.setText(N_('Update Existing Branch:')) self.no_update_radio = qtutils.radio(text=N_('No')) self.ffwd_only_radio = qtutils.radio(text=N_('Fast Forward Only'), checked=True) self.reset_radio = qtutils.radio(text=N_('Reset')) text = N_('Fetch Tracking Branch') self.fetch_checkbox = qtutils.checkbox(text=text, checked=True) text = N_('Checkout After Creation') self.checkout_checkbox = qtutils.checkbox(text=text, checked=True) icon = icons.branch() self.create_button = qtutils.create_button(text=N_('Create Branch'), icon=icon, default=True) self.close_button = qtutils.close_button() self.rev_start_group = QtGui.QGroupBox() self.rev_start_group.setTitle(N_('Starting Revision')) self.option_group = QtGui.QGroupBox() self.option_group.setTitle(N_('Options')) self.options_checkbox_layout = qtutils.vbox(defs.margin, defs.spacing, self.fetch_checkbox, self.checkout_checkbox) self.options_bottom_layout = qtutils.hbox(defs.margin, defs.spacing, self.options_checkbox_layout, qtutils.STRETCH) self.branch_name_layout = qtutils.hbox(defs.margin, defs.spacing, self.branch_name_label, self.branch_name) self.rev_start_radiobtn_layout = qtutils.hbox(defs.margin, defs.spacing, self.local_radio, self.remote_radio, self.tag_radio, qtutils.STRETCH) self.rev_start_textinput_layout = qtutils.hbox(defs.no_margin, defs.spacing, self.rev_label, self.revision) self.rev_start_layout = qtutils.vbox(defs.no_margin, defs.spacing, self.rev_start_radiobtn_layout, self.branch_list, self.rev_start_textinput_layout) self.rev_start_group.setLayout(self.rev_start_layout) self.options_radio_layout = qtutils.hbox(defs.no_margin, defs.spacing, self.update_existing_label, self.no_update_radio, self.ffwd_only_radio, self.reset_radio) self.options_grp_layout = qtutils.vbox(defs.no_margin, defs.spacing, self.options_radio_layout, self.options_bottom_layout) self.option_group.setLayout(self.options_grp_layout) self.buttons_layout = qtutils.hbox(defs.margin, defs.spacing, self.create_button, self.close_button) self.options_section_layout = qtutils.hbox(defs.no_margin, defs.spacing, self.option_group, self.buttons_layout) self.main_layout = qtutils.vbox(defs.margin, defs.spacing, self.branch_name_layout, self.rev_start_group, self.options_section_layout) self.setLayout(self.main_layout) qtutils.connect_button(self.close_button, self.reject) qtutils.connect_button(self.create_button, self.create_branch) qtutils.connect_button(self.local_radio, self.display_model) qtutils.connect_button(self.remote_radio, self.display_model) qtutils.connect_button(self.tag_radio, self.display_model) self.connect(self.branch_list, SIGNAL('itemSelectionChanged()'), self.branch_item_changed) self.connect(self.thread, SIGNAL(COMMAND_SIGNAL), self.thread_command, Qt.QueuedConnection) self.connect(self.thread, SIGNAL('done(PyQt_PyObject)'), self.thread_done, Qt.QueuedConnection) self.resize(555, 333) self.display_model()
def __init__(self, cfg, model, parent=None): QtGui.QDialog.__init__(self, parent) self.cfg = cfg self.model = model if parent is not None: self.setWindowModality(Qt.WindowModal) self.setAttribute(Qt.WA_MacMetalStyle) # Widgets self.title_label = QtGui.QLabel() self.revision_label = QtGui.QLabel() self.revision_label.setText(N_("Revision to Merge")) self.revision = completion.GitRefLineEdit() self.revision.setFocus() self.revision.setToolTip(N_("Revision to Merge")) self.radio_local = qtutils.radio(text=N_("Local Branch"), checked=True) self.radio_remote = qtutils.radio(text=N_("Tracking Branch")) self.radio_tag = qtutils.radio(text=N_("Tag")) self.revisions = QtGui.QListWidget() self.revisions.setAlternatingRowColors(True) self.button_viz = qtutils.create_button(text=N_("Visualize"), icon=icons.visualize()) tooltip = N_("Squash the merged commit(s) into a single commit") self.checkbox_squash = qtutils.checkbox(text=N_("Squash"), tooltip=tooltip) tooltip = N_("Always create a merge commit when enabled, " "even when the merge is a fast-forward update") self.checkbox_noff = qtutils.checkbox(text=N_("No fast forward"), tooltip=tooltip, checked=False) self.checkbox_noff_state = False tooltip = N_("Commit the merge if there are no conflicts. " "Uncheck to leave the merge uncommitted") self.checkbox_commit = qtutils.checkbox(text=N_("Commit"), tooltip=tooltip, checked=True) self.checkbox_commit_state = True text = N_("Create Signed Commit") checked = cfg.get("cola.signcommits", False) tooltip = N_("GPG-sign the merge commit") self.checkbox_sign = qtutils.checkbox(text=text, checked=checked, tooltip=tooltip) self.button_close = qtutils.close_button() icon = icons.merge() self.button_merge = qtutils.create_button(text=N_("Merge"), icon=icon) # Layouts self.revlayt = qtutils.hbox( defs.no_margin, defs.spacing, self.revision_label, self.revision, qtutils.STRETCH, self.title_label ) self.radiolayt = qtutils.hbox(defs.no_margin, defs.spacing, self.radio_local, self.radio_remote, self.radio_tag) self.buttonlayt = qtutils.hbox( defs.no_margin, defs.button_spacing, self.button_viz, qtutils.STRETCH, self.checkbox_squash, self.checkbox_noff, self.checkbox_commit, self.checkbox_sign, self.button_close, self.button_merge, ) self.mainlayt = qtutils.vbox( defs.margin, defs.spacing, self.radiolayt, self.revisions, self.revlayt, self.buttonlayt ) self.setLayout(self.mainlayt) # Signal/slot connections self.connect(self.revision, SIGNAL("textChanged(QString)"), self.update_title) self.connect(self.revisions, SIGNAL("itemSelectionChanged()"), self.revision_selected) qtutils.connect_button(self.button_close, self.reject) qtutils.connect_button(self.checkbox_squash, self.toggle_squash) qtutils.connect_button(self.radio_local, self.update_revisions) qtutils.connect_button(self.radio_remote, self.update_revisions) qtutils.connect_button(self.radio_tag, self.update_revisions) qtutils.connect_button(self.button_merge, self.merge_revision) qtutils.connect_button(self.button_viz, self.viz_revision) # Observer messages model.add_observer(model.message_updated, self.update_all) self.update_all() self.resize(700, 400)
def __init__(self, cfg, model, parent=None): QtGui.QDialog.__init__(self, parent) self.cfg = cfg self.model = model if parent is not None: self.setWindowModality(Qt.WindowModal) self.setAttribute(Qt.WA_MacMetalStyle) # Widgets self.title_label = QtGui.QLabel() self.revision_label = QtGui.QLabel() self.revision_label.setText(N_('Revision to Merge')) self.revision = completion.GitRefLineEdit() self.revision.setFocus() self.revision.setToolTip(N_('Revision to Merge')) self.radio_local = qtutils.radio(text=N_('Local Branch'), checked=True) self.radio_remote = qtutils.radio(text=N_('Tracking Branch')) self.radio_tag = qtutils.radio(text=N_('Tag')) self.revisions = QtGui.QListWidget() self.revisions.setAlternatingRowColors(True) self.button_viz = qtutils.create_button(text=N_('Visualize'), icon=icons.visualize()) tooltip = N_('Squash the merged commit(s) into a single commit') self.checkbox_squash = qtutils.checkbox(text=N_('Squash'), tooltip=tooltip) tooltip = N_('Always create a merge commit when enabled, ' 'even when the merge is a fast-forward update') self.checkbox_noff = qtutils.checkbox(text=N_('No fast forward'), tooltip=tooltip, checked=False) self.checkbox_noff_state = False tooltip = N_('Commit the merge if there are no conflicts. ' 'Uncheck to leave the merge uncommitted') self.checkbox_commit = qtutils.checkbox(text=N_('Commit'), tooltip=tooltip, checked=True) self.checkbox_commit_state = True text = N_('Create Signed Commit') checked = cfg.get('cola.signcommits', False) tooltip = N_('GPG-sign the merge commit') self.checkbox_sign = qtutils.checkbox(text=text, checked=checked, tooltip=tooltip) self.button_close = qtutils.close_button() icon = icons.merge() self.button_merge = qtutils.create_button(text=N_('Merge'), icon=icon) # Layouts self.revlayt = qtutils.hbox(defs.no_margin, defs.spacing, self.revision_label, self.revision, qtutils.STRETCH, self.title_label) self.radiolayt = qtutils.hbox(defs.no_margin, defs.spacing, self.radio_local, self.radio_remote, self.radio_tag) self.buttonlayt = qtutils.hbox( defs.no_margin, defs.button_spacing, self.button_viz, qtutils.STRETCH, self.checkbox_squash, self.checkbox_noff, self.checkbox_commit, self.checkbox_sign, self.button_close, self.button_merge) self.mainlayt = qtutils.vbox(defs.margin, defs.spacing, self.radiolayt, self.revisions, self.revlayt, self.buttonlayt) self.setLayout(self.mainlayt) # Signal/slot connections self.connect(self.revision, SIGNAL('textChanged(QString)'), self.update_title) self.connect(self.revisions, SIGNAL('itemSelectionChanged()'), self.revision_selected) qtutils.connect_button(self.button_close, self.reject) qtutils.connect_button(self.checkbox_squash, self.toggle_squash) qtutils.connect_button(self.radio_local, self.update_revisions) qtutils.connect_button(self.radio_remote, self.update_revisions) qtutils.connect_button(self.radio_tag, self.update_revisions) qtutils.connect_button(self.button_merge, self.merge_revision) qtutils.connect_button(self.button_viz, self.viz_revision) # Observer messages model.add_observer(model.message_updated, self.update_all) self.update_all() self.resize(700, 400)