Example #1
0
 def validatePage(self):
     selected_profile_name = self.field('database_profile_name')
     new_profile_name = self.field('database_profile_new_name')
     if selected_profile_name:
         try:
             selected_profile = Profile.get(selected_profile_name)
         except ProfileNotFoundError:
             logger.debug("Profile named {} was not found".format(selected_profile_name))
             return False
     else:
         selected_profile = None
     
     if new_profile_name == selected_profile_name:
         profile = selected_profile
     else:
         try:
             profile = Profile.get(new_profile_name)
         except ProfileNotFoundError:
             if selected_profile:
                 profile = selected_profile
                 profile.name = new_profile_name
             else:
                 profile = Profile(name=new_profile_name, driver=self.current_driver)
         except:
             raise
         else:
             QtGui.QMessageBox.information(self, 'New Database Profile',
                 "A profile with this name already exists. Choose another name.", QtGui.QMessageBox.Ok)
             return False
     
     self.driverForms[self.current_driver.name].save(profile)
     profile.use()
     
     return True
Example #2
0
    def initializePage(self):
        selected_profile_name = self.field('database_profile_name')
        if not selected_profile_name:
            return

        # Fill the form with the selected profile
        try:
            profile = Profile.get(selected_profile_name)
        except ProfileNotFoundError:
            logger.debug(
                "Profile named {} was not found".format(selected_profile_name))
            self.wizard().back()
        else:
            if not profile.editable:
                logger.debug("Profile named {} is not editable".format(
                    selected_profile_name))
                self.wizard.back()

        index = self.drivers.index(profile.driver)
        self.driverChoice.setCurrentIndex(index)
        for form in self.driverForms.itervalues():
            form.clear()
        self.driverForms[self.current_driver.name].setProfile(profile)

        self.profileText.setText(selected_profile_name)
Example #3
0
    def validatePage(self):
        if self.field('database_profile_new'):
            return True

        selected_profile_name = self.field('database_profile_name')
        if not selected_profile_name:
            return False

        try:
            profile = Profile.get(selected_profile_name)
        except ProfileNotFoundError:
            return False
        else:
            if not profile.editable and self.field('database_profile_edit'):
                return False

        return True
Example #4
0
 def validatePage(self):
     if self.field('database_profile_new'):
         return True
     
     selected_profile_name = self.field('database_profile_name')
     if not selected_profile_name:
         return False
     
     try:
         profile = Profile.get(selected_profile_name)
     except ProfileNotFoundError:
         return False
     else:
         if not profile.editable and self.field('database_profile_edit'):
             return False
     
     return True
Example #5
0
 def initializePage(self):
     selected_profile_name = self.field('database_profile_name')
     if not selected_profile_name:
         return
     
     # Fill the form with the selected profile
     try:
         profile = Profile.get(selected_profile_name)
     except ProfileNotFoundError:
         logger.debug("Profile named {} was not found".format(selected_profile_name))
         self.wizard().back()
     else:
         if not profile.editable:
             logger.debug("Profile named {} is not editable".format(selected_profile_name))
             self.wizard.back()
     
     index = self.drivers.index(profile.driver)
     self.driverChoice.setCurrentIndex(index)
     for form in self.driverForms.itervalues():
         form.clear()
     self.driverForms[self.current_driver.name].setProfile(profile)
     
     self.profileText.setText(selected_profile_name)
Example #6
0
    def validatePage(self):
        selected_profile_name = self.field('database_profile_name')
        new_profile_name = self.field('database_profile_new_name')
        if selected_profile_name:
            try:
                selected_profile = Profile.get(selected_profile_name)
            except ProfileNotFoundError:
                logger.debug("Profile named {} was not found".format(
                    selected_profile_name))
                return False
        else:
            selected_profile = None

        if new_profile_name == selected_profile_name:
            profile = selected_profile
        else:
            try:
                profile = Profile.get(new_profile_name)
            except ProfileNotFoundError:
                if selected_profile:
                    profile = selected_profile
                    profile.name = new_profile_name
                else:
                    profile = Profile(name=new_profile_name,
                                      driver=self.current_driver)
            except:
                raise
            else:
                QtGui.QMessageBox.information(
                    self, 'New Database Profile',
                    "A profile with this name already exists. Choose another name.",
                    QtGui.QMessageBox.Ok)
                return False

        self.driverForms[self.current_driver.name].save(profile)
        profile.use()

        return True
Example #7
0
 def initializePage(self):
     self.profileCombo.clear()
     for p in Profile.get_all():
         self.profileCombo.addItem(p.name, p)
     self.profileCombo.setCurrentIndex(-1)
Example #8
0
 def initializePage(self):
     self.profileCombo.clear()
     for p in Profile.get_all():
         self.profileCombo.addItem(p.name, p)
     self.profileCombo.setCurrentIndex(-1)