def __init__(self): super(AddTaskWindow, self).__init__() NewTaskForm.QtGui.QDialog.__init__(self) NewTaskForm.Ui_Dialog.__init__(self) self.setupUi(self) self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() self.queries = DatabaseQueries(self.app_dir) self.new_task_name = self.TaskLineEdit.text() self.all_projects = self.queries.get_all_projects() self.all_tasks = self.queries.query_all_tasks( ) # For blocker/blockee selection for project in self.all_projects: self.ProjectComboBox.addItem(project[1]) # TODO: Allow setting of "None" in blockers & blockees. (Make this the default for each) for task in self.all_tasks: # TODO: prevent crossing blockers and blockees self.BlockedByComboBox.addItem(task[1]) self.BlocksComboBox.addItem(task[1]) # Handle OK button click self.buttonBox.button(NewTaskForm.QtGui.QDialogButtonBox.Ok).clicked. \ connect(self.create_new_task)
def __init__(self): LoginWindow.QtGui.QDialog.__init__(self) LoginWindow.Ui_LoginWIndow.__init__(self) self.setupUi(self) self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() self.queries = DatabaseQueries(self.app_dir) self.setFixedSize(self.size()) # Prevent resizing # Hide password entry (show asterisks) self.LoginWindowPasswordEdit.setEchoMode(QLineEdit.Password) # Disable the OK button at first. self.buttonBox.button( LoginWindow.QtGui.QDialogButtonBox.Ok).setEnabled(False) # Enable the "OK" button once user has entered text into fields self.LoginWindowUsernameEdit.textChanged.connect( self.line_edit_text_changed) self.LoginWindowPasswordEdit.textChanged.connect( self.line_edit_text_changed) # Handle button clicks self.RegisterNewUserButton.clicked.connect( self.handle_register_button_clicked) ## handle "OK" clicked in buttonbox self.buttonBox.button( LoginWindow.QtGui.QDialogButtonBox.Ok).clicked.connect( self.handle_login)
def __init__(self): ivcs_mainwindow.QtGui.QMainWindow.__init__(self) ivcs_mainwindow.Ui_MainWindow.__init__(self) self.setupUi(self) self.image_extensions = [] self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() self.queries = DatabaseQueries(self.app_dir) self.setFixedSize(self.size()) # Prevent resizing if not os.path.exists(os.path.join(self.app_dir, 'ivcs.ini')): logging.warning( "Couldn't find configuration file at {}, after it should have been " "automatically created.".format(self.app_dir)) # Disable all GUI elements until a branch is set and scanned self.RemoteChangesListView.setEnabled(False) self.LocalFileListVIew.setEnabled(False) self.RemoteChangesListView.setEnabled(False) self.LocalChangesListView.setEnabled(False) self.CheckoutButton.setEnabled(False) self.ViewRemoteCommitButton.setEnabled(False) self.CommitButton.setEnabled(False) self.PushButton.setEnabled(False) else: # Enable multiple selection self.RemoteFileListView.setSelectionMode( QAbstractItemView.ExtendedSelection) self.LocalFileListVIew.setSelectionMode( QAbstractItemView.ExtendedSelection) # Load current settings self.config_file_path = os.path.join(self.app_dir, 'ivcs.ini') self.config = configparser.ConfigParser() self.config.read(self.config_file_path) self.change_detection_method = self.config.get( "settings", "changedetectmethod") self.username = self.config.get("settings", "username") self.image_extensions = ast.literal_eval( self.config.get("settings", "imageextensions")) self.storage_path = self.config.get("settings", "datapath") # Handle main window buttons self.CheckoutButton.clicked.connect( self.handle_checkout_button_click) self.UpdateAllButton.clicked.connect(self.handle_update_all_button) # Menu Bar Actions self.actionSettings.triggered.connect(self.handle_settings_click) self.actionManage_Projects.triggered.connect( self.handle_manage_projects_click) self.open_database(self.username) self.handle_update_all_button()
def __init__(self): super(AddProjectWindow, self).__init__() AddProject.QtGui.QDialog.__init__(self) AddProject.Ui_Dialog.__init__(self) self.setupUi(self) self.setFixedSize(self.size()) # Prevent resizing general_functions = filesystem_utils.GeneralFunctions() self.app_dir = general_functions.get_application_path() # Create DB session self.db = DatabaseQueries(self.app_dir) # handle "OK" clicked in buttonbox self.buttonBox.button(AddProject.QtGui.QDialogButtonBox.Ok).clicked.\ connect(self.create_new_project)
def create_new_project(self): """ Adds the project name from the Add Project window to the db :return: None """ self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() project_name = self.ProjectNameEntryEdit.text() result = self.db.add_new_project(project_name) self.queries = DatabaseQueries(self.app_dir) if result == 1: # User tried to enter a project that already exists # Bring up error message text = "Error: Project already exists in database." error_window = ErrorMessagePopup(text) error_window.show() error_window.exec_()
def open_database(self, username): """ Opens up the DB :return: None """ self.username = username logging.info("Querying the database for user projects.") queries = DatabaseQueries(self.app_dir) projects = queries.query_projects_for_user(self.username) if projects is ValueError: # Could not find any users matching the name logging.error( "Could not find any rows in Users DB for current username.") else: for project in projects: print("Projects associated with user: {}".format( project)) # TODO: Remove this after testing
def __init__(self, image_extensions): super(ProjectsWindow, self).__init__() self.image_extensions = image_extensions ManageProjectsWindow.QtGui.QDialog.__init__(self) ManageProjectsWindow.Ui_ManageProjectsWindow.__init__(self) self.setupUi(self) # Select first item in list by default #self.ProjectsList.item(0).setSelected(True) self.setFixedSize(self.size()) # Prevent resizing # Set the global application path self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() # Get list of projects self.queries = DatabaseQueries(self.app_dir) db = ImageryDatabase(self.app_dir) db_session = db.load_session() self.projects = self.queries.get_all_projects() # Do something when an item in the projects list is clicked self.ProjectsList.itemClicked.connect(self.handle_project_clicked) # Handle the various add/remove buttons self.AddProjectButton.clicked.connect(self.handle_add_project_clicked) self.RemoveProjectButton.clicked.connect( self.handle_remove_project_button) self.AddProjectDirectoryButton.clicked.connect( self.handle_project_add_dir_button) self.RemoveDirectoryFromProjectButton.clicked.connect( self.handle_delete_project_dir_button) self.AddTaskButton.clicked.connect(self.handle_add_task_button) self.RemoveTaskButton.clicked.connect(self.handle_delete_task_button) self.update_projects_list() self.update_tasks_list()
def __init__(self): super(NewUserWindow, self).__init__() NewUserRegistrationWindow.QtGui.QDialog.__init__(self) NewUserRegistrationWindow.Ui_NewUserWindow.__init__(self) self.setupUi(self) # Hide password entry (show asterisks) self.NewUserPasswordEntry.setEchoMode(QLineEdit.Password) self.setFixedSize(self.size()) # Prevent resizing self.general_functions = filesystem_utils.GeneralFunctions() self.app_dir = self.general_functions.get_application_path() self.queries = DatabaseQueries(self.app_dir) # Enable OK button if all fields contain text self.NewUserNameEntry.textChanged.connect(self.line_edit_text_changed) self.NewUserUsernameEntry.textChanged.connect( self.line_edit_text_changed) self.NewUserPasswordEntry.textChanged.connect( self.line_edit_text_changed) self.NewUserEmailEntry.textChanged.connect(self.line_edit_text_changed) # User variables self.name = None self.username = None self.password = None self.email = None # handle "OK" clicked in buttonbox self.buttonBox.button(NewUserRegistrationWindow.QtGui.QDialogButtonBox.Ok).clicked.\ connect(self.create_new_user) # Disable OK button at first self.buttonBox.button(NewUserRegistrationWindow.QtGui.QDialogButtonBox.Ok). \ setEnabled(False)