def _file_selector_add(self): self._fs_filecounter = 0 self._fs = FileSelector(self) self._fs.filter = self._fs_filter self._fs.multi = False self.action_disabled_set("add_new_file", "Select", True) self._fs.callback_add("file.selected", self._fs_file_selected_cb) self._fs.callback_add("file.unselected", self._fs_file_unselected_cb) self._fs.show()
def __init__(self, master=None, root_path=None): super().__init__(master) self.master = master self.root_path = root_path self.fs = FileSelector() self.outfile = tk.StringVar() # # calling initialise functions # self.master.resizable(width=False, height=False) self._createWidgets() self._bindEvents() self._setLayout()
def __init__(self, open_cb, *args, **kargs): elementary.Window.__init__(self, "openfile", elementary.ELM_WIN_BASIC) self.title_set("Open file") self.autodel_set(True) self._open_cb = (open_cb, args, kargs) bg = elementary.Background(self) self.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() self._fs = FileSelector(self) self._fs.filter = self._filter self._fs.action_add("Cancel", self._cancel) self._fs.action_add("Ok", self._open) self._fs.action_disabled_set("Ok", True) self._fs.callback_add("file.clicked", self._file_clicked) self._fs.callback_add("file.selected", self._file_selected) self._fs.callback_add("file.selection_clear", self._file_unselected) self.resize_object_add(self._fs) self._fs.show() self.resize(600, 480)
def run(self): host_config = {} host_config['id'] = self.askHostId() host_config['address'] = self.askHostAddress() host_config['os'] = self.askOS() host_config['distro'] = self.askDistro(host_config['os']) host_config['dev'] = self.askDevEnv(host_config['distro']) host_config['user'] = self.askUsername() print usekey = self.askUseKeySecurity() while (usekey): fileSelector = FileSelector(constants.KEY_FILES_DIR, (".pem", ".ppk"), constants.KEY_FILE_TEXT) keyFile = fileSelector.select() if (not keyFile): print constants.NO_KEY_AVAILABLE print usekey = not self.askFallbackToPass() else: host_config['key-file'] = keyFile host_config['security'] = 'key' break if (not usekey): host_config['security'] = 'pass' host_config['pass'] = self.askPass() usePreTask = self.askUsePreparationTaskFile() if (usePreTask): fileSelector = FileSelector(constants.PREPARED_TASKS_DIR, constants.PLAYBOOK_FILE_EXTENSION, constants.PREPARATION_TASK_FILE_TEXT) taskFile = fileSelector.select() if (taskFile): host_config[ 'pre-tasks'] = constants.PREPARED_TASKS_DIR + "/" + taskFile else: print print "[Error] No prepared tasks available. Place prepared playbooks in '" + constants.PREPARED_TASKS_DIR + "' directory and run again." print print configFile = constants.CONFIGS_DIR + '/' + host_config[ 'os'] + constants.CONFIG_FILE_EXTENSION packageHandler = PackageHandler(configFile) host_config['packages'] = packageHandler.selectPackages(host_config) host_config[ 'additional_packages'] = packageHandler.selectAdditionalPackages() print usePostTask = self.askUsePostInstallTaskFile() if (usePostTask): fileSelector = FileSelector( constants.PREPARED_TASKS_DIR, (".yml", ".yaml"), constants.POST_INSTALLATION_TASK_FILE_TEXT) taskFile = fileSelector.select() if (taskFile): host_config[ 'post-tasks'] = constants.PREPARED_TASKS_DIR + "/" + taskFile else: print print "[Error] No prepared tasks available. Place prepared playbooks in '" + constants.PREPARED_TASKS_DIR + "' directory and run again." print inventory_creator = InventoryCreator() inventory_creator.create(host_config, constants.INVENTORIES_DIR) playbook_creator = PlaybookCreator() playbook_creator.create(host_config, constants.PLAYBOOKS_DIR) print print "Successfully created entry for " + host_config['id'] print