Beispiel #1
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

            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)
Beispiel #2
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)
Beispiel #3
0
def test_log():

    # set level: 'debug','info','warning','error','critical'
    log.setLevel('warning')

    # print messages of all levels: 1,2,4,8,16 for 'debug','info',...
    log.setPrintBits(0377)

    log.debug('This is a test message 1', __name__)
    log.info('This is a test message 2', __name__)
    log.warning('This is a test message 3', __name__)
    log.error('This is a test message 4', __name__)
    log.critical('This is a test message 5', __name__)
    log.critical('This is a test message 6')

    print 'getLogContent():\n', log.getLogContent()
    print 'getLogContentTotal():\n', log.getLogContentTotal()
Beispiel #4
0
    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
Beispiel #5
0
    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