コード例 #1
0
ファイル: instlGui.py プロジェクト: BambiHaber/instl
    def update_client_state(self, *args):
        var_stack.set_var("CLIENT_GUI_CMD").append(self.client_command_name_var.get())
        self.update_client_input_file_combo()

        _, input_file_base_name = os.path.split(var_stack.unresolved_var("CLIENT_GUI_IN_FILE"))
        var_stack.set_var("CLIENT_GUI_IN_FILE_NAME").append(input_file_base_name)

        var_stack.set_var("CLIENT_GUI_OUT_FILE").append(self.client_output_path_var.get())
        var_stack.set_var("CLIENT_GUI_RUN_BATCH").append(bool_int_to_str(self.run_client_batch_file_var.get()))
        var_stack.set_var("CLIENT_GUI_CREDENTIALS").append(self.client_credentials_var.get())
        var_stack.set_var("CLIENT_GUI_CREDENTIALS_ON").append(self.client_credentials_on_var.get())

        if self.client_command_name_var.get() in self.commands_with_run_option_list:
            self.client_run_batch_file_checkbox.configure(state='normal')
        else:
            self.client_run_batch_file_checkbox.configure(state='disabled')

        command_line = " ".join(self.create_client_command_line())

        self.client_command_line_var.set(var_stack.resolve(command_line))
コード例 #2
0
ファイル: instlGui.py プロジェクト: BambiHaber/instl
    def update_admin_state(self, *args):
        var_stack.set_var("ADMIN_GUI_CMD").append(self.admin_command_name_var.get())

        current_config_path = var_stack.resolve_var("ADMIN_GUI_CONFIG_FILE", default="")
        new_config_path = self.admin_config_path_var.get()
        if current_config_path != new_config_path:
            self.admin_config_file_dirty = True
        var_stack.set_var("ADMIN_GUI_CONFIG_FILE").append(new_config_path)
        if self.admin_config_file_dirty:
             self.read_admin_config_file()

        _, input_file_base_name = os.path.split(var_stack.unresolved_var("ADMIN_GUI_CONFIG_FILE"))
        var_stack.set_var("ADMIN_GUI_CONFIG_FILE_NAME").append(input_file_base_name)

        var_stack.set_var("ADMIN_GUI_OUT_BATCH_FILE").append(self.admin_output_path_var.get())

        var_stack.set_var("ADMIN_GUI_RUN_BATCH").append(bool_int_to_str(self.run_admin_batch_file_var.get()))
        var_stack.set_var("ADMIN_GUI_LIMIT").append(self.admin_limit_var.get())

        self.admin_stage_index_var.set(var_stack.resolve("$(__STAGING_INDEX_FILE__)"))
        self.admin_svn_repo_var.set(var_stack.resolve("$(SVN_REPO_URL), REPO_REV: $(REPO_REV)"))

        sync_url = var_stack.resolve("$(SYNC_BASE_URL)")
        self.admin_sync_url_var.set(sync_url)

        if self.admin_command_name_var.get() in self.commands_that_accept_limit_option:
            self.limit_path_entry_widget.configure(state='normal')
        else:
            self.limit_path_entry_widget.configure(state='disabled')

        if self.admin_command_name_var.get() in self.commands_with_run_option_list:
            self.admin_run_batch_file_checkbox.configure(state='normal')
        else:
            self.admin_run_batch_file_checkbox.configure(state='disabled')

        command_line = " ".join(self.create_admin_command_line())

        self.admin_command_line_var.set(var_stack.resolve(command_line))
コード例 #3
0
ファイル: instlGui.py プロジェクト: BambiHaber/instl
    def create_client_frame(self, master):

        client_frame = Frame(master)
        client_frame.grid(row=0, column=0)


        curr_row = 0
        command_label = Label(client_frame, text="Command:")
        command_label.grid(row=curr_row, column=0, sticky=W)

        # instl command selection
        client_command_list = var_stack.resolve_var_to_list("__CLIENT_GUI_CMD_LIST__")
        self.client_command_name_var.set(var_stack.unresolved_var("CLIENT_GUI_CMD"))
        OptionMenu(client_frame, self.client_command_name_var,
                   self.client_command_name_var.get(), *client_command_list, command=self.update_client_state).grid(row=curr_row, column=1, sticky=W)

        self.run_client_batch_file_var.set(str_to_bool_int(var_stack.unresolved_var("CLIENT_GUI_RUN_BATCH")))
        self.client_run_batch_file_checkbox = Checkbutton(client_frame, text="Run batch file",
                    variable=self.run_client_batch_file_var, command=self.update_client_state)
        self.client_run_batch_file_checkbox.grid(row=curr_row, column=2, sticky=E)

        # path to input file
        curr_row += 1
        Label(client_frame, text="Input file:").grid(row=curr_row, column=0)
        self.client_input_path_var.set(var_stack.unresolved_var("CLIENT_GUI_IN_FILE"))
        self.client_input_combobox = Combobox(client_frame, textvariable=self.client_input_path_var)
        self.client_input_combobox.grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        self.client_input_path_var.trace('w', self.update_client_state)
        Button(client_frame, width=2, text="...", command=self.get_client_input_file).grid(row=curr_row, column=3, sticky=W)
        Button(client_frame, width=4, text="Edit",
               command=lambda: self.open_file_for_edit(var_stack.resolve_var("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=4, sticky=W)
        Button(client_frame, width=3, text="Chk",
               command=lambda: self.check_yaml(var_stack.resolve_var("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=5, sticky=W)

        # path to output file
        curr_row += 1
        Label(client_frame, text="Batch file:").grid(row=curr_row, column=0)
        self.client_output_path_var.set(var_stack.unresolved_var("CLIENT_GUI_OUT_FILE"))
        Entry(client_frame, textvariable=self.client_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        self.client_output_path_var.trace('w', self.update_client_state)
        Button(client_frame, width=2, text="...", command=self.get_client_output_file).grid(row=curr_row, column=3, sticky=W)
        Button(client_frame, width=4, text="Edit",
                command=lambda: self.open_file_for_edit(var_stack.resolve_var("CLIENT_GUI_OUT_FILE"))).grid(row=curr_row, column=4, sticky=W)

        # s3 user credentials
        curr_row += 1
        Label(client_frame, text="Credentials:").grid(row=curr_row, column=0, sticky=E)
        self.client_credentials_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS"))
        Entry(client_frame, textvariable=self.client_credentials_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        self.client_credentials_var.trace('w', self.update_client_state)

        self.client_credentials_on_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS_ON"))
        Checkbutton(client_frame, text="", variable=self.client_credentials_on_var).grid(row=curr_row, column=3, sticky=W)
        self.client_credentials_on_var.trace('w', self.update_client_state)

        # the combined command line text
        curr_row += 1
        Button(client_frame, width=6, text="run:", command=self.run_client).grid(row=curr_row, column=0, sticky=W)
        self.client_command_line_var = StringVar()
        Label(client_frame, textvariable=self.client_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=4, sticky=W)

        client_frame.grid_columnconfigure(0, minsize=80)
        client_frame.grid_columnconfigure(1, minsize=300)
        client_frame.grid_columnconfigure(2, minsize=80)

        return client_frame
コード例 #4
0
ファイル: instlGui.py プロジェクト: BambiHaber/instl
    def create_admin_frame(self, master):

        admin_frame = Frame(master)
        admin_frame.grid(row=0, column=1)

        curr_row = 0
        Label(admin_frame, text="Command:").grid(row=curr_row, column=0, sticky=E)

        # instl command selection
        self.admin_command_name_var.set(var_stack.unresolved_var("ADMIN_GUI_CMD"))
        admin_command_list = var_stack.resolve_var_to_list("__ADMIN_GUI_CMD_LIST__")
        commandNameMenu = OptionMenu(admin_frame, self.admin_command_name_var,
                                     self.admin_command_name_var.get(), *admin_command_list, command=self.update_admin_state)
        commandNameMenu.grid(row=curr_row, column=1, sticky=W)
        ToolTip(commandNameMenu, msg="instl admin command")

        self.run_admin_batch_file_var.set(str_to_bool_int(var_stack.unresolved_var("ADMIN_GUI_RUN_BATCH")))
        self.admin_run_batch_file_checkbox = Checkbutton(admin_frame, text="Run batch file", variable=self.run_admin_batch_file_var,
                    command=self.update_admin_state)
        self.admin_run_batch_file_checkbox.grid(row=curr_row, column=2, columnspan=2, sticky=E)

        # path to config file
        curr_row += 1
        Label(admin_frame, text="Config file:").grid(row=curr_row, column=0, sticky=E)
        self.admin_config_path_var.set(var_stack.unresolved_var("ADMIN_GUI_CONFIG_FILE"))
        configFilePathEntry = Entry(admin_frame, textvariable=self.admin_config_path_var)
        configFilePathEntry.grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        ToolTip(configFilePathEntry, msg="path instl repository config file")
        self.admin_config_path_var.trace('w', self.update_admin_state)

        openConfigButt = Button(admin_frame, width=2, text="...", command=self.get_admin_config_file)
        openConfigButt.grid(row=curr_row, column=3, sticky=W)
        ToolTip(openConfigButt, msg="open admin config file")

        editConfigButt = Button(admin_frame, width=4, text="Edit",
                                command=lambda: self.open_file_for_edit(var_stack.resolve_var("ADMIN_GUI_CONFIG_FILE")))
        editConfigButt.grid(row=curr_row, column=4, sticky=W)
        ToolTip(editConfigButt, msg="edit admin config file")

        checkConfigButt = Button(admin_frame, width=3, text="Chk",
                                 command=lambda: self.check_yaml(var_stack.resolve_var("ADMIN_GUI_CONFIG_FILE")))
        checkConfigButt.grid(row=curr_row, column=5, sticky=W)
        ToolTip(checkConfigButt, msg="read admin config file to check it's structure")

        # path to stage index file
        curr_row += 1
        Label(admin_frame, text="Stage index:").grid(row=curr_row, column=0, sticky=E)
        Label(admin_frame, text="---", textvariable=self.admin_stage_index_var).grid(row=curr_row, column=1, columnspan=2, sticky=W)
        editIndexButt = Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve("$(__STAGING_INDEX_FILE__)", raise_on_fail=True)))
        editIndexButt.grid(row=curr_row, column=4, sticky=W)
        ToolTip(editIndexButt, msg="edit repository index")

        checkIndexButt = Button(admin_frame, width=3, text="Chk",  command=lambda: self.check_yaml(var_stack.resolve("$(__STAGING_INDEX_FILE__)")))
        checkIndexButt.grid(row=curr_row, column=5, sticky=W)
        ToolTip(checkIndexButt, msg="read repository index to check it's structure")

        # path to svn repository
        curr_row += 1
        Label(admin_frame, text="Svn repo:").grid(row=curr_row, column=0, sticky=E)
        svnRepoLabel = Label(admin_frame, text="---", textvariable=self.admin_svn_repo_var)
        svnRepoLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W)
        ToolTip(svnRepoLabel, msg="URL of the SVN repository with current repo-rev")

        # sync URL
        curr_row += 1
        Label(admin_frame, text="Sync URL:").grid(row=curr_row, column=0, sticky=E)
        syncURLLabel = Label(admin_frame, text="---", textvariable=self.admin_sync_url_var)
        syncURLLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W)
        ToolTip(syncURLLabel, msg="Top URL for uploading to the repository")

        # path to output file
        curr_row += 1
        Label(admin_frame, text="Batch file:").grid(row=curr_row, column=0, sticky=E)
        self.admin_output_path_var.set(var_stack.unresolved_var("ADMIN_GUI_OUT_BATCH_FILE"))
        Entry(admin_frame, textvariable=self.admin_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        self.admin_output_path_var.trace('w', self.update_admin_state)
        Button(admin_frame, width=2, text="...", command=self.get_admin_output_file).grid(row=curr_row, column=3, sticky=W)
        Button(admin_frame, width=4, text="Edit",
                command=lambda: self.open_file_for_edit(var_stack.resolve_var("ADMIN_GUI_OUT_BATCH_FILE"))).grid(row=curr_row, column=4, sticky=W)

        # relative path to limit folder
        curr_row += 1
        Label(admin_frame, text="Limit to:").grid(row=curr_row, column=0, sticky=E)
        self.admin_limit_var.set(var_stack.unresolved_var("ADMIN_GUI_LIMIT"))
        self.limit_path_entry_widget = Entry(admin_frame, textvariable=self.admin_limit_var)
        self.limit_path_entry_widget.grid(row=curr_row, column=1, columnspan=2, sticky=W+E)
        self.admin_limit_var.trace('w', self.update_admin_state)

        # the combined command line text
        curr_row += 1
        Button(admin_frame, width=6, text="run:", command=self.run_admin).grid(row=curr_row, column=0, sticky=W)
        self.admin_command_line_var = StringVar()
        Label(admin_frame, textvariable=self.admin_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=2, sticky=W)

        return admin_frame