def on_but_mask_editor(self): logger.debug('onLogger', self.name) self.setStatus( 1, 'Work with mask editor... DO NOT FORGET TO SAVE MASK!!!') mfname = self.fname_roi_mask_img.value() try: if cp.maskeditor is not None and not os.path.exists(mfname): msg = 'File %s was not saved!\nContinue anyway?' % os.path.basename( mfname) logger.warning(msg, __name__) status = gu.confirm_or_cancel_dialog_box( parent=self, text=msg, title='Confirm or cancel') if not status: return cp.maskeditor.close() del cp.maskeditor cp.maskeditor = None self.but_mask_editor.setStyleSheet(cp.styleButtonLeft) self.but_mask_editor.setText(' 4. Open Mask Editor') except: self.but_mask_editor.setStyleSheet(cp.styleButtonGood) self.but_mask_editor.setText('Close Mask Editor') self.openFileWithImageArray() pars = self.dictOfMaskEditorPars() cp.maskeditor = MaskEditor(**pars) cp.maskeditor.move(self.pos().__add__(QtCore.QPoint( 820, -7))) # open window with offset w.r.t. parent cp.maskeditor.show() self.setStatus(0)
def on_but_mask_editor (self): logger.debug('onLogger', self.name) self.setStatus(1, 'Work with mask editor... DO NOT FORGET TO SAVE MASK!!!') mfname = self.fname_roi_mask_img.value() try : if cp.maskeditor is not None and not os.path.exists(mfname) : msg = 'File %s was not saved!\nContinue anyway?' % os.path.basename(mfname) logger.warning(msg, __name__) status = gu.confirm_or_cancel_dialog_box(parent=self, text=msg, title='Confirm or cancel') if not status : return self.disconnect(cp.maskeditor, QtCore.SIGNAL('MaskEditorWindowIsClosed()'), self.on_mask_editor_window_is_closed) cp.maskeditor.close() del cp.maskeditor cp.maskeditor = None self.but_mask_editor.setStyleSheet(cp.styleButtonLeft) self.but_mask_editor.setText(' 4. Open Mask Editor') except : self.but_mask_editor.setStyleSheet(cp.styleButtonGood) self.but_mask_editor.setText('Close Mask Editor') self.openFileWithImageArray() pars = self.dictOfMaskEditorPars () cp.maskeditor = MaskEditor(**pars) cp.maskeditor.move(self.pos().__add__(QtCore.QPoint(820,-7))) # open window with offset w.r.t. parent cp.maskeditor.show() self.connect(cp.maskeditor, QtCore.SIGNAL('MaskEditorWindowIsClosed()'), self.on_mask_editor_window_is_closed) self.setStatus(0)
def on_but_roi_img_nda(self): logger.info('Select file with ndarray for image', __name__) msg = 'Ok - continue to select file with ndarray\nCancel - use ndarray of ones' status = gu.confirm_or_cancel_dialog_box(parent=self, text=msg, title='Sele') if not status : self.fname_roi_img_nda.setValue('') self.edi_roi_img_nda.setText('') else : self.set_file_name(self.edi_roi_img_nda, self.fname_roi_img_nda, mode='open')
def on_but_geo(self): #logger.info('Start geo', __name__) resp = gu.confirm_or_cancel_dialog_box(parent=self, text='Please confirm or cancel command', title='Confirm or cancel') if resp : cmd = self.get_command() logger.info('Start app by the command: %s' % cmd, __name__) os.system(cmd) else : logger.info('Command is canceled', __name__)
def on_but_roi_img_nda(self): logger.info('Select file with ndarray for image', __name__) msg = 'Ok - continue to select file with ndarray\nCancel - use ndarray of ones' status = gu.confirm_or_cancel_dialog_box(parent=self, text=msg, title='Sele') if not status: self.fname_roi_img_nda.setValue('') self.edi_roi_img_nda.setText('') else: self.set_file_name(self.edi_roi_img_nda, self.fname_roi_img_nda, mode='open')
def select_file_for_plot(self): list = [ self.fname_roi_img.value() \ , self.fname_roi_mask_img.value() \ , self.fname_roi_mask_nda.value() \ , self.fname_roi_mask_nda_tst.value() \ ] fname = gu.selectFromListInPopupMenu(list) if fname is None : return None if not os.path.exists(fname) : logger.warning('File %s does not exist. There is nothing to plot...' % fname, __name__) return None logger.info('Selected file for plot: %s' % fname, __name__) return fname
def select_file_for_plot(self): list = [ self.fname_roi_img.value() \ , self.fname_roi_mask_img.value() \ , self.fname_roi_mask_nda.value() \ , self.fname_roi_mask_nda_tst.value() \ ] fname = gu.selectFromListInPopupMenu(list) if fname is None: return None if not os.path.exists(fname): logger.warning( 'File %s does not exist. There is nothing to plot...' % fname, __name__) return None logger.info('Selected file for plot: %s' % fname, __name__) return fname
def openFileWithImageArray(self): path = self.fname_roi_img.value() self.img_arr = gu.get_image_array_from_file( path) # , dtype=np.float32)
def openFileWithImageArray(self) : path = self.fname_roi_img.value() self.img_arr = gu.get_image_array_from_file(path) # , dtype=np.float32)