示例#1
0
    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()
示例#2
0
    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()