def on_pushButtonLoad_pressed(self):
        """Load Image
        """
        input_dir = sett.readSetting('images/input_dir')
        image = QFileDialog.getOpenFileName(self,
                    u'打开图片文件',
                    input_dir,
                    'Images (*.jpg *.jpeg *.bmp *.png *.tiff *.tif *.gif);;' \
                    'All files (*.*)')

        if not image:
            self.show_msg(u'未选择文件…')
            return
        self.load_image(image)
        sett.storeSetting('images/input_dir', os.path.dirname(str(image)));
    def on_pushButtonLoad_pressed(self):
        """Load Image
        """
        input_dir = sett.readSetting('images/input_dir')
        image = QFileDialog.getOpenFileName(self,
                    'Open Image file',
                    input_dir,
                    'Images (*.jpg *.jpeg *.bmp *.png *.tiff *.tif *.gif);;' \
                    'All files (*.*)')

        if not image:
            self.show_msg(u'File was not selected…')
            return
        self.load_image(image)
        sett.storeSetting('images/input_dir', os.path.dirname(str(image)))
    def on_pushButtonLoad_pressed(self):
        """Load Image
        """
        input_dir = sett.readSetting('images/input_dir')
        image = QFileDialog.getOpenFileName(
            self,
            'Open Image file',
            input_dir,
            'Images (*.jpg *.jpeg *.bmp *.png *.tiff *.tif *.gif);;'
            'All files (*.*)')

        if not image:
            self.show_msg('File was not selected…')
            return
        if isinstance(image, tuple):
            filename = image[0]
        else:
            filename = image
        self.load_image(filename)
        sett.storeSetting('images/input_dir', os.path.dirname(filename))
 def closeEvent(self, event):
     """Store setting on exit
     """
     sett.storeSetting('geometry', self.saveGeometry())
     sett.storeSetting('state', self.saveState())
     sett.storeSetting("splitter_1Sizes", self.splitter_1.saveState());
     sett.storeSetting("splitter_1Geo", self.splitter_1.saveGeometry());
     sett.storeSetting("splitter_2Sizes", self.splitter_2.saveState());
     sett.storeSetting('images/last_filename', self.image_name)
     sett.storeSetting('images/zoom_factor', self.getZoomFactor())
     row_l = self.comboBoxLang.currentIndex()
     lang = self.comboBoxLang.itemData(row_l).toString()
     if lang:
         sett.storeSetting('language', lang)
     row_p = self.comboBoxPSM.currentIndex()
     sett.storeSetting('PSM',
                       self.comboBoxPSM.itemData(row_p).toString())
     row_r = self.comboBoxRIL.currentIndex()
     sett.storeSetting('RIL',
                       self.comboBoxRIL.itemData(row_r).toString())
     QMainWindow.closeEvent(self, event)
 def closeEvent(self, event):
     """Store setting on exit
     """
     sett.storeSetting('geometry', self.saveGeometry())
     sett.storeSetting('state', self.saveState())
     sett.storeSetting("splitter_1Sizes", self.splitter_1.saveState())
     sett.storeSetting("splitter_1Geo", self.splitter_1.saveGeometry())
     sett.storeSetting("splitter_2Sizes", self.splitter_2.saveState())
     sett.storeSetting('images/last_filename', self.image_name)
     sett.storeSetting('images/zoom_factor', self.getZoomFactor())
     row_l = self.comboBoxLang.currentIndex()
     lang = self.comboBoxLang.itemData(row_l).toString()
     if lang:
         sett.storeSetting('language', lang)
     row_p = self.comboBoxPSM.currentIndex()
     sett.storeSetting('PSM', self.comboBoxPSM.itemData(row_p).toString())
     row_r = self.comboBoxRIL.currentIndex()
     sett.storeSetting('RIL', self.comboBoxRIL.itemData(row_r).toString())
     QMainWindow.closeEvent(self, event)