def on_new_picture(self): file_name = QtGui.QFileDialog.getOpenFileName( self, filter='Image (*.png)', directory=self.config.get( 'frame_image_dir', os.path.expanduser('~') ) ) if file_name: from mqme.mainwindow import MainWindow file_name = unicode(file_name) self.config.set('frame_image_dir', os.path.dirname(file_name)) MainWindow.queue.put({'name': 'config.save'}) if not 'pathes' in Config().current_file(): Config().current_file()['pathes'] = {} image_id = str(uuid.uuid1()) Config().current_file()['pathes'][image_id] = file_name frame_key = self.get_frame_key() if not frame_key in self.current_conf: self.current_conf[frame_key] = [] frame_image = FrameImage( self._scroll_areas[self._current_frame].widget(), file_name, image_id, frame_key ) frame_image.show() width, height = frame_image.ratio() x = 0.5 - (width / 2.0) y = 1.0 - height self.current_conf[frame_key].append({ 'id': image_id, 'width': width, 'height': height, 'x': x, 'y': y }) frame_image.setGeometry( 200 + x * 100, 200 + y * 100, width * 100, height * 100 )