def scmSpecificLineEdit(self,
                         initial_value,
                         case_blind=False,
                         strip=True,
                         validator=None):
     widget = wb_dialog_bases.WbLineEdit(initial_value, case_blind, strip,
                                         validator)
     widget.textChanged.connect(self.enableOkButton)
     return widget
    def __init__(self, app, parent, default_message):
        self.app = app

        super().__init__(parent)

        self.setWindowTitle(
            T_('Stash save - %s') % (' '.join(app.app_name_parts), ))

        self.message = wb_dialog_bases.WbLineEdit(default_message)

        em = self.fontMetrics().width('M')
        self.addRow(T_('Save message'), self.message, min_width=em * 50)
        self.addButtons()
    def __init__(self, app, parent, prefs_project, scm_project):
        self.app = app
        self.prefs_project = prefs_project
        self.scm_project = scm_project

        self.old_project_name = prefs_project.name

        prefs = self.app.prefs

        self.all_other_existing_project_names = set()

        for prefs_project in prefs.getAllProjects():
            if self.old_project_name != prefs_project.name:
                self.all_other_existing_project_names.add(
                    prefs_project.name.lower())

        super().__init__(parent)

        v = wb_dialog_bases.WbValidateUnique(
            self.all_other_existing_project_names,
            T_('Enter a new project name that has not been used for another project'
               ))
        self.name = wb_dialog_bases.WbLineEdit(self.prefs_project.name,
                                               case_blind=True,
                                               strip=True,
                                               validator=v)

        f = self.app.getScmFactory(self.prefs_project.scm_type)

        self.setWindowTitle(
            T_('Project settings for %s') % (self.prefs_project.name, ))

        self.addNamedDivider(T_('General'))
        self.addRow(T_('Name'), self.name)
        self.addRow(T_('SCM Type'), f.scmPresentationLongName())
        self.addRow(T_('Path'), str(self.prefs_project.path))
        self.scmSpecificAddRows()
        self.addFeedbackWidget()
        self.addButtons()

        self.ok_button.setEnabled(False)
        self.name.textChanged.connect(self.enableOkButton)

        em = self.app.fontMetrics().width('m')
        self.setMinimumWidth(60 * em)
Esempio n. 4
0
    def __init__( self, wizard ):
        super().__init__( wizard )

        self.setTitle( T_('Add Git Project') )
        self.setSubTitle( T_('Clone Git repository') )

        #------------------------------------------------------------
        v = wb_dialog_bases.WbValidateUrl( all_supported_schemes,
                    T_('Fill in the upstream URL') )
        self.url_upstream = wb_dialog_bases.WbLineEdit( '', validator=v )

        self.setup_upstream = wb_dialog_bases.WbCheckBox(
                T_('git remote upstream. Usually required when using a forked repository'),
                False )

        self.setup_upstream.stateChanged.connect( self.url_upstream.setEnabled )
        self.url_upstream.setEnabled( False )

        self.setup_upstream.stateChanged.connect( self._fieldsChanged )
        self.url_upstream.textChanged.connect( self._fieldsChanged )

        #------------------------------------------------------------
        self.pull_rebase = QtWidgets.QCheckBox( T_('git pull --rebase') )
        self.pull_rebase.setChecked( True )

        #------------------------------------------------------------
        self.grid_layout.addNamedDivider( T_('git remote origin') )
        self.grid_layout.addRow( T_('Repository URL'), self.url )

        self.grid_layout.addNamedDivider( T_('git remote upstream') )
        self.grid_layout.addRow( T_('remote upstream'), self.setup_upstream )
        self.grid_layout.addRow( T_('upstream URL'),  self.url_upstream )

        self.grid_layout.addNamedDivider( T_('git config --local') )
        self.grid_layout.addRow( T_('pull.rebase'), self.pull_rebase )

        self.grid_layout.addFeedbackWidget()