示例#1
0
def main():
    """
    Starts the program
    :return: None
    """

    logger()
    logging.info("IVCS started.")

    # TESTING
    io = filesystem_utils.FileCopier(
        "/Users/rwardrup/Downloads/pycharm-professional-2016.2.3.dmg")
    io.run()

    general_functions = filesystem_utils.GeneralFunctions()

    # Create config file
    app_dir = general_functions.get_application_path()

    if not os.path.exists(os.path.join(app_dir, 'ivcs.ini')):
        initialize_config(app_dir)
        logging.info("Created configuration file at {}".format(app_dir))

    # Instantiate the first windows
    login = LoginWindow.QtGui.QApplication(sys.argv)
    login_window = UserLoginWindow()
    login_window.show()
    login.exec_()
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
    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()
示例#5
0
def logger():
    """
    Sets up the logfile
    :return: None
    """

    fs_utils = filesystem_utils.GeneralFunctions()
    path = fs_utils.get_application_path()
    logfile = os.path.join(path, 'IVCS.log')
    log = logging.basicConfig(
        filename=logfile,
        format='%(asctime)s %(levelname)s -> %(message)s',
        level=logging.DEBUG,
        datefmt='%Y-%m-%d %H:%M:%S')

    return log
示例#6
0
    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)
示例#7
0
    def __init__(self):
        settings_window.QtGui.QDialog.__init__(self)
        settings_window.Ui_Dialog.__init__(self)
        self.setupUi(self)
        self.image_extensions = []
        self.username = None
        self.storage_path = None
        self.change_detection_method = None

        self.setFixedSize(self.size())  # Prevent resizing

        fs_utils = filesystem_utils.GeneralFunctions()
        self.main_window = MainWindow()

        # Load current settings
        self.app_dir = fs_utils.get_application_path()
        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")

        if self.change_detection_method == "hash":
            self.UseChecksums.setChecked(True)
        elif self.change_detection_method == "modification_time":
            self.UseOSModifiedDate.setChecked(True)
        else:
            logging.error("Invalid value in change_detection_method.")
            raise ValueError

        if ".img" in self.image_extensions:
            self.ImgExtensionCheckBox.setChecked(True)
        if ".tif" in self.image_extensions:
            self.TifExtensionCheckBox.setChecked(True)

        self.UserNameEntry.setText(self.username)
        self.DataStoragePathEntry.setText(self.storage_path)

        # Buttonbox actions
        self.buttonBox.button(settings_window.QtGui.QDialogButtonBox.Ok).\
            clicked.connect(self.save_settings)
示例#8
0
    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_()
示例#9
0
    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()
示例#10
0
    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)