def single_miz_path(self) -> Path or None: t = self.single_miz.text() if len(t) > 3: p = Path(t) if p.exists() and p.isfile() and p.ext == '.miz': return p return None
def _download(self): def proceed_with_download(): downloader.download( url=dl_url, local_file=local_file, progress_title='Downloading {}'.format(dl_url.split('/').pop()), progress_text=local_file, file_size=file_size ) dl_url, file_size, local_file_name = appveyor.latest_version_download_url(self.selected_branch) local_file = Path(self.auto_src_path).joinpath(local_file_name).abspath() if local_file.exists(): I.confirm(text='Local file already exists; do you want to overwrite?', follow_up=proceed_with_download) else: proceed_with_download()
def __init__(self): self.single_group = GroupBox() self.single_miz = QLineEdit() self.single_miz.setDisabled(True) if Config().single_miz_last: p = Path(Config().single_miz_last) if p.exists() and p.isfile() and p.ext == '.miz': self.single_miz.setText(str(p.abspath())) self.single_miz_browse = PushButton('Browse', self.browse_for_single_miz) self.single_miz_open = PushButton('Open', self.open_single_miz) self.single_miz_output_folder = QLineEdit() self.single_miz_output_folder.setDisabled(True) if Config().single_miz_output_folder: p = Path(Config().single_miz_output_folder) self.single_miz_output_folder.setText(str(p.abspath())) self.single_miz_output_folder_browse = PushButton('Browse', self.browse_for_single_miz_output_folder) self.single_miz_output_folder_open = PushButton('Open', self.open_single_miz_output_folder) self.single_miz_reorder_btn = PushButton('Reorder MIZ file', self.single_reorder) self.single_miz_reorder_btn.setMinimumHeight(40) self.single_miz_reorder_btn.setMinimumWidth(400) self.single_layout = VLayout([ GridLayout( [ [(Label('Source MIZ'), dict(align='r')), self.single_miz, self.single_miz_browse, self.single_miz_open], [(Label('Output folder'), dict(align='r')), self.single_miz_output_folder, self.single_miz_output_folder_browse, self.single_miz_output_folder_open], ], ), self.single_miz_reorder_btn, ]) self.single_group.setLayout(self.single_layout)