def closeEvent(self, e): if not self.saved: svdlg = dialog.QuestionDialog( 'You have unsaved changes, are you sure you wish to quit?') if svdlg.clickedButton() == svdlg.yes: e.accept() else: e.ignore() else: e.accept()
def compile_av(self): time.sleep(1) import subprocess as sp save_dir = SETTINGS.settings_list['save_dir'] try: vd_in = max(glob.iglob(os.path.join(TMP_DIR, '*.mp4')), key=os.path.getctime) except Exception as e: dialog.ErrorMsg(repr(e)) try: os.environ["File"] out = os.path.join( save_dir, os.environ['File'] + '.' + SETTINGS.settings_list['ext']) except KeyError: os.environ[ "File"] = "new_output" + '.' + SETTINGS.settings_list['ext'] finally: if os.environ['File'] != '': out = os.path.join( save_dir, os.environ['File'] + '.' + SETTINGS.settings_list['ext']) else: out = os.path.join( save_dir, 'new_output' + '.' + SETTINGS.settings_list['ext']) if os.path.isfile(out): question = dialog.QuestionDialog( 'This File exists. Are you sure you wish to overwrite it?') if question.clickedButton() == question.yes: self.ex = '%s -i %s -codec copy -y %s' % (FFMPEG_BIN, vd_in, out) sp.call(self.ex, shell=True, stderr=sp.PIPE) else: pass else: self.ex = 'ffmpeg -i %s -codec copy -y %s' % (vd_in, out) sp.call(self.ex, shell=True, stderr=sp.PIPE) if ('question' in locals() and question.clickedButton() == question.yes) or ('question' not in locals()): os.remove(vd_in) if os.path.isfile(out): os.environ['LastFile'] = out else: dialog.ErrorMsg("File Not Found. Failed to save.") else: os.environ['LastFile'] = vd_in
def closeEvent(self, e): if self.video is not None: if self.video.isRunning: from modules import dialog dlg = dialog.QuestionDialog('You are currently recording. Do you wish to quit? If so, your data may be lost.') if dlg.clickedButton() == dlg.yes: e.accept() else: e.ignore() else: e.accept() else: e.accept()
def clearGraphic(self): if not self.saved: svdlg = dialog.QuestionDialog( 'You have unsaved changes, are you sure you wish to start again?' ) if svdlg.clickedButton() == svdlg.yes: self.scene.clear() self.ellipses = list() else: pass else: self.scene.clear() self.ellipses = list()
def save(self): if self.drpdwn_ext.currentText( ) != self.settings.settings_list['ext'] or self.drpdwn_av.currentText( ) != self.settings.settings_list['av']: dlg = dialog.QuestionDialog('Are you ready to save changes?') if dlg.clickedButton() == dlg.yes: if self.drpdwn_ext.currentText( ) != self.settings.settings_list['ext']: self.settings.edit('ext', self.drpdwn_ext.currentText()) SETTINGS.settings_list[ 'ext'] = self.drpdwn_ext.currentText() if self.drpdwn_av.currentText( ) != self.settings.settings_list['av']: self.settings.edit('av', self.drpdwn_av.currentText()) SETTINGS.settings_list['av'] = self.drpdwn_av.currentText() else: pass