예제 #1
0
    def _display_items(self):
        """
        Populate the commit_list with the current directories and items

        Directories are always listed first.

        """

        # Clear commit/revision fields
        self.view.commit_text.setText('')
        self.view.revision.setText('')

        dir_icon = resources.icon('dir.png')
        file_icon = resources.icon('generic.png')
        # Factory method for creating items
        creator = qtutils.create_listwidget_item

        # First the directories,
        qtutils.set_items(self.view.commit_list,
                          map(lambda d: creator(d, dir_icon),
                              self.model.directories))
        # and now the filenames
        qtutils.add_items(self.view.commit_list,
                          map(lambda s: creator(s, file_icon),
                              self.model.subtree_names))
예제 #2
0
 def display_remotes(self, widget):
     """Display the available remotes in a listwidget"""
     displayed = []
     for remote_name in self.model.remotes:
         url = self.model.remote_url(remote_name, self.action)
         display = "%s\t(%s)" % (remote_name, N_("URL: %s") % url)
         displayed.append(display)
     qtutils.set_items(widget, displayed)
예제 #3
0
 def display_remotes(self, widget):
     """Display the available remotes in a listwidget"""
     displayed = []
     for remote_name in self.model.remotes:
         url = self.model.remote_url(remote_name, self.action)
         display = ('%s\t(%s)' % (remote_name, N_('URL: %s') % url))
         displayed.append(display)
     qtutils.set_items(widget, displayed)
예제 #4
0
파일: remote.py 프로젝트: adrlwill/git-cola
 def display_remotes(self, widget):
     """Display the available remotes in a listwidget"""
     displayed = []
     for remote_name in self.model.remotes:
         url = self.model.remote_url(remote_name, self.action)
         display = ('%s\t(%s %s)'
                    % (remote_name, unicode(self.tr('URL:')), url))
         displayed.append(display)
     qtutils.set_items(widget,displayed)
예제 #5
0
 def select_commits(self):
     summaries = self.model.summaries
     if not summaries:
         msg = N_('No commits exist in this branch.')
         Interaction.log(msg)
         return []
     qtutils.set_items(self.commit_list, summaries)
     self.show()
     if self.exec_() != QtGui.QDialog.Accepted:
         return []
     return self.selected_commits()
예제 #6
0
 def select_commits(self):
     summaries = self.model.summaries
     if not summaries:
         msg = N_('No commits exist in this branch.')
         Interaction.log(msg)
         return []
     qtutils.set_items(self.commit_list, summaries)
     self.show()
     if self.exec_() != QtGui.QDialog.Accepted:
         return []
     return self.selected_commits()
예제 #7
0
 def select_commits(self):
     summaries = self.model.summaries
     if not summaries:
         msg = self.tr('No commits exist in this branch.')
         qtutils.log(1, msg)
         return []
     qtutils.set_items(self.commit_list, summaries)
     self.show()
     if self.exec_() != QtGui.QDialog.Accepted:
         return []
     revs = self.model.revisions
     return qtutils.selection_list(self.commit_list, revs)
예제 #8
0
 def select_commits(self):
     summaries = self.model.summaries
     if not summaries:
         msg = self.tr('No commits exist in this branch.')
         qtutils.log(1, msg)
         return []
     qtutils.set_items(self.commit_list, summaries)
     self.show()
     if self.exec_() != QtGui.QDialog.Accepted:
         return []
     revs = self.model.revisions
     return qtutils.selection_list(self.commit_list, revs)
예제 #9
0
    def __init__(self, parent=None, revs=None):
        QtGui.QWidget.__init__(self, parent)

        self._revs = revs
        self._revdict = dict(revs)

        self._layt = QtGui.QVBoxLayout()
        self._layt.setMargin(0)
        self.setLayout(self._layt)

        self._rev_layt = QtGui.QHBoxLayout()
        self._rev_layt.setMargin(0)

        self._rev_label = QtGui.QLabel()
        self._rev_layt.addWidget(self._rev_label)

        self._revision = QtGui.QLineEdit()
        self._rev_layt.addWidget(self._revision)

        self._layt.addLayout(self._rev_layt)

        self._radio_layt = QtGui.QHBoxLayout()
        self._radio_btns = {}

        # Create the radio buttons
        for label, rev_list in self._revs:
            radio = QtGui.QRadioButton()
            radio.setText(self.tr(label))
            radio.setObjectName(label)
            self.connect(radio, SIGNAL('clicked()'), self._set_revision_list)
            self._radio_layt.addWidget(radio)
            self._radio_btns[label] = radio

        self._radio_spacer = QtGui.QSpacerItem(1, 1,
                                               QtGui.QSizePolicy.Expanding,
                                               QtGui.QSizePolicy.Minimum)
        self._radio_layt.addItem(self._radio_spacer)

        self._layt.addLayout(self._radio_layt)

        self._rev_list = QtGui.QListWidget()
        self._layt.addWidget(self._rev_list)

        label, rev_list = self._revs[0]
        self._radio_btns[label].setChecked(True)
        qtutils.set_items(self._rev_list, rev_list)

        self.connect(self._rev_list, SIGNAL('itemSelectionChanged()'),
                     self._rev_list_selection_changed)
예제 #10
0
    def __init__(self, parent, revs):
        QtGui.QWidget.__init__(self, parent)

        self._revs = revs
        self._revdict = dict(revs)

        self._layt = QtGui.QVBoxLayout()
        self._layt.setMargin(0)
        self.setLayout(self._layt)

        self._rev_layt = QtGui.QHBoxLayout()
        self._rev_layt.setMargin(0)

        self._rev_label = QtGui.QLabel()
        self._rev_layt.addWidget(self._rev_label)

        self._revision = completion.GitRefLineEdit()
        self._rev_layt.addWidget(self._revision)

        self._layt.addLayout(self._rev_layt)

        self._radio_layt = QtGui.QHBoxLayout()
        self._radio_btns = {}

        # Create the radio buttons
        for label, rev_list in self._revs:
            radio = QtGui.QRadioButton()
            radio.setText(label)
            radio.setObjectName(label)
            qtutils.connect_button(radio, self._set_revision_list)
            self._radio_layt.addWidget(radio)
            self._radio_btns[label] = radio

        self._radio_layt.addStretch()

        self._layt.addLayout(self._radio_layt)

        self._rev_list = QtGui.QListWidget()
        self._layt.addWidget(self._rev_list)

        label, rev_list = self._revs[0]
        self._radio_btns[label].setChecked(True)
        qtutils.set_items(self._rev_list, rev_list)

        self.connect(self._rev_list, SIGNAL('itemSelectionChanged()'),
                     self._rev_list_selection_changed)
예제 #11
0
    def __init__(self, parent, revs):
        QtGui.QWidget.__init__(self, parent)

        self._revs = revs
        self._revdict = dict(revs)

        self._layt = QtGui.QVBoxLayout()
        self._layt.setMargin(0)
        self.setLayout(self._layt)

        self._rev_layt = QtGui.QHBoxLayout()
        self._rev_layt.setMargin(0)

        self._rev_label = QtGui.QLabel()
        self._rev_layt.addWidget(self._rev_label)

        self._revision = completion.GitRefLineEdit()
        self._rev_layt.addWidget(self._revision)

        self._layt.addLayout(self._rev_layt)

        self._radio_layt = QtGui.QHBoxLayout()
        self._radio_btns = {}

        # Create the radio buttons
        for label, rev_list in self._revs:
            radio = QtGui.QRadioButton()
            radio.setText(label)
            radio.setObjectName(label)
            qtutils.connect_button(radio, self._set_revision_list)
            self._radio_layt.addWidget(radio)
            self._radio_btns[label] = radio

        self._radio_layt.addStretch()

        self._layt.addLayout(self._radio_layt)

        self._rev_list = QtGui.QListWidget()
        self._layt.addWidget(self._rev_list)

        label, rev_list = self._revs[0]
        self._radio_btns[label].setChecked(True)
        qtutils.set_items(self._rev_list, rev_list)

        self.connect(self._rev_list, SIGNAL('itemSelectionChanged()'),
                     self._rev_list_selection_changed)
예제 #12
0
    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 = QtGui.QRadioButton()
            radio.setText(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)
예제 #13
0
 def _set_revision_list(self):
     sender = unicode(self.sender().objectName())
     revs = self._revdict[sender]
     qtutils.set_items(self._rev_list, revs)
예제 #14
0
 def display_model(self):
     """Sets the branch list to the available branches
     """
     branches = self.branch_sources()
     qtutils.set_items(self.branch_list, branches)
예제 #15
0
 def _set_revision_list(self):
     sender = ustr(self.sender().objectName())
     revs = self._revdict[sender]
     qtutils.set_items(self._rev_list, revs)