def __init__(self, *arg, **kw): super(KeywordsEditor, self).__init__(*arg, **kw) self.config_store = QtWidgets.QApplication.instance().config_store self.league_table = defaultdict(int) for keyword, score in eval( self.config_store.get('descriptive', 'keywords', '{}')).items(): self.league_table[keyword] = score layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) # line edit box self.edit = SingleLineEdit(spell_check=True) layout.addWidget(self.edit) # favourites drop down self.favourites = QtWidgets.QComboBox() self.update_favourites() self.favourites.currentIndexChanged.connect(self.add_favourite) layout.addWidget(self.favourites) # adopt child widget methods and signals self.get_value = self.edit.get_value self.set_value = self.edit.set_value self.set_multiple = self.edit.set_multiple self.is_multiple = self.edit.is_multiple self.editingFinished = self.edit.editingFinished
def new_album(self): dialog = QtWidgets.QDialog(parent=self) dialog.setWindowTitle(self.tr('Create new Facebook album')) dialog.setLayout(QtWidgets.QFormLayout()) name = SingleLineEdit(spell_check=True) dialog.layout().addRow(self.tr('Title'), name) message = MultiLineEdit(spell_check=True) dialog.layout().addRow(self.tr('Description'), message) location = SingleLineEdit(spell_check=True) dialog.layout().addRow(self.tr('Location'), location) privacy = QtWidgets.QComboBox() for display_name, value in ( (self.tr('Only me'), '{value: "SELF"}'), (self.tr('All friends'), '{value: "ALL_FRIENDS"}'), (self.tr('Friends of friends'), '{value: "FRIENDS_OF_FRIENDS"}'), (self.tr('Friends + networks'), '{value: "NETWORKS_FRIENDS"}'), (self.tr('Everyone'), '{value: "EVERYONE"}'), ): privacy.addItem(display_name, value) dialog.layout().addRow(self.tr('Privacy'), privacy) button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) button_box.accepted.connect(dialog.accept) button_box.rejected.connect(dialog.reject) dialog.layout().addRow(button_box) if dialog.exec_() != QtWidgets.QDialog.Accepted: return if not self.authorise('write'): self.refresh(force=True) return name = name.toPlainText().strip() if not name: return data = {'name': name} message = message.toPlainText().strip() if message: data['message'] = message location = location.toPlainText().strip() if location: data['location'] = location data['privacy'] = privacy.itemData(privacy.currentIndex()) try: album = self.session.post('https://graph.facebook.com/me/albums', data=data) except Exception as ex: self.logger.error(str(ex)) self.refresh(force=True) return self.load_user_data(album_id=album['id'])
def __init__(self, image_list, parent=None): super(TabWidget, self).__init__(parent) app = QtWidgets.QApplication.instance() app.aboutToQuit.connect(self.shutdown) if gp and app.test_mode: self.gp_log = gp.check_result(gp.use_python_logging()) self.config_store = app.config_store self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) form = QtWidgets.QFormLayout() form.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.nm = NameMangler() self.file_data = {} self.file_list = [] self.source = None self.file_reader = None self.file_writer = None # source selector box = QtWidgets.QHBoxLayout() box.setContentsMargins(0, 0, 0, 0) self.source_selector = QtWidgets.QComboBox() self.source_selector.currentIndexChanged.connect(self.new_source) box.addWidget(self.source_selector) refresh_button = QtWidgets.QPushButton(self.tr('refresh')) refresh_button.clicked.connect(self.refresh) box.addWidget(refresh_button) box.setStretch(0, 1) form.addRow(self.tr('Source'), box) # path format self.path_format = QtWidgets.QLineEdit() self.path_format.setValidator(PathFormatValidator()) self.path_format.textChanged.connect(self.nm.new_format) self.path_format.editingFinished.connect(self.path_format_finished) form.addRow(self.tr('Target format'), self.path_format) # path example self.path_example = QtWidgets.QLabel() self.nm.new_example.connect(self.path_example.setText) form.addRow('=>', self.path_example) self.layout().addLayout(form, 0, 0) # file list self.file_list_widget = QtWidgets.QListWidget() self.file_list_widget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.file_list_widget.itemSelectionChanged.connect(self.selection_changed) self.layout().addWidget(self.file_list_widget, 1, 0) # selection buttons buttons = QtWidgets.QVBoxLayout() buttons.addStretch(1) self.selected_count = QtWidgets.QLabel() self.selection_changed() buttons.addWidget(self.selected_count) select_all = QtWidgets.QPushButton(self.tr('Select\nall')) select_all.clicked.connect(self.select_all) buttons.addWidget(select_all) select_new = QtWidgets.QPushButton(self.tr('Select\nnew')) select_new.clicked.connect(self.select_new) buttons.addWidget(select_new) self.copy_button = StartStopButton(self.tr('Copy\nphotos'), self.tr('Stop\nimport')) self.copy_button.click_start.connect(self.copy_selected) self.copy_button.click_stop.connect(self.stop_copy) buttons.addWidget(self.copy_button) self.layout().addLayout(buttons, 0, 1, 2, 1) # final initialisation self.image_list.sort_order_changed.connect(self.sort_file_list) path = os.path.expanduser('~/Pictures') if not os.path.isdir(path) and sys.platform == 'win32': try: import win32com.shell as ws path = ws.shell.SHGetFolderPath( 0, ws.shellcon.CSIDL_MYPICTURES, None, 0) except ImportError: pass self.path_format.setText( os.path.join(path, '%Y', '%Y_%m_%d', '{name}')) self.refresh() self.list_files()
def __init__(self, image_list, parent=None): super(PhotiniMap, self).__init__(parent) self.logger = logging.getLogger(self.__class__.__name__) self.app = QtWidgets.QApplication.instance() self.config_store = self.app.config_store self.image_list = image_list self.script_dir = pkg_resources.resource_filename( 'photini', 'data/' + self.__class__.__name__.lower() + '/') self.drag_icon = QtGui.QPixmap( os.path.join(self.script_dir, 'grey_marker.png')) self.search_string = None self.map_loaded = False self.marker_images = {} self.map_status = {} self.setChildrenCollapsible(False) left_side = QtWidgets.QWidget() self.addWidget(left_side) self.grid = QtWidgets.QGridLayout() self.grid.setContentsMargins(0, 0, 0, 0) self.grid.setRowStretch(6, 1) self.grid.setColumnStretch(1, 1) left_side.setLayout(self.grid) # map self.map = WebView() self.map.setPage(WebPage(parent=self.map)) if QtWebEngineWidgets: self.web_channel = QtWebChannel.QWebChannel() self.map.page().setWebChannel(self.web_channel) self.web_channel.registerObject('python', self) else: self.map.page().setLinkDelegationPolicy( QtWebKitWidgets.QWebPage.DelegateAllLinks) self.map.page().linkClicked.connect(self.link_clicked) self.map.page().mainFrame().javaScriptWindowObjectCleared.connect( self.java_script_window_object_cleared) self.map.setAcceptDrops(False) self.map.drop_text.connect(self.drop_text) self.addWidget(self.map) # search self.grid.addWidget( QtWidgets.QLabel(translate('PhotiniMap', 'Search:')), 0, 0) self.edit_box = QtWidgets.QComboBox() self.edit_box.setMinimumWidth(200) self.edit_box.setEditable(True) self.edit_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.edit_box.lineEdit().setPlaceholderText( translate('PhotiniMap', '<new search>')) self.edit_box.lineEdit().returnPressed.connect(self.search) self.edit_box.activated.connect(self.goto_search_result) self.clear_search() self.edit_box.setEnabled(False) self.grid.addWidget(self.edit_box, 0, 1) # latitude & longitude self.grid.addWidget( QtWidgets.QLabel(translate('PhotiniMap', 'Lat, long:')), 1, 0) self.coords = SingleLineEdit() self.coords.editingFinished.connect(self.new_coords) self.coords.setEnabled(False) self.grid.addWidget(self.coords, 1, 1) # convert lat/lng to location info self.auto_location = QtWidgets.QPushButton( translate('PhotiniMap', 'Lat, long -> location')) self.auto_location.setEnabled(False) self.auto_location.clicked.connect(self.get_address) self.grid.addWidget(self.auto_location, 2, 1) # location info self.location_info = LocationInfo() self.location_info['taken'].new_value.connect(self.new_location_taken) self.location_info['shown'].new_value.connect(self.new_location_shown) self.location_info.swap.clicked.connect(self.swap_locations) self.location_info.setEnabled(False) self.grid.addWidget(self.location_info, 3, 0, 1, 2) # load map button self.load_map = QtWidgets.QPushButton( translate('PhotiniMap', '\nLoad map\n')) self.load_map.clicked.connect(self.initialise) self.grid.addWidget(self.load_map, 7, 0, 1, 2) # other init self.image_list.image_list_changed.connect(self.image_list_changed) self.splitterMoved.connect(self.new_split)
def __init__(self, image_list, parent=None): super(TabWidget, self).__init__(parent) self.app = QtWidgets.QApplication.instance() self.app.aboutToQuit.connect(self.stop_copy) if gp and self.app.options.test: self.gp_log = gp.check_result(gp.use_python_logging()) self.config_store = self.app.config_store self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) form = QtWidgets.QFormLayout() form.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.nm = NameMangler() self.file_data = {} self.file_list = [] self.source = None self.file_copier = None self.updating = QtCore.QMutex() # source selector box = QtWidgets.QHBoxLayout() box.setContentsMargins(0, 0, 0, 0) self.source_selector = QtWidgets.QComboBox() self.source_selector.currentIndexChanged.connect(self.new_source) self.source_selector.setContextMenuPolicy(Qt.CustomContextMenu) self.source_selector.customContextMenuRequested.connect( self.remove_folder) box.addWidget(self.source_selector) refresh_button = QtWidgets.QPushButton( translate('ImporterTab', 'refresh')) refresh_button.clicked.connect(self.refresh) box.addWidget(refresh_button) box.setStretch(0, 1) form.addRow(translate('ImporterTab', 'Source'), box) # update config self.config_store.delete('importer', 'folders') for section in self.config_store.config.sections(): if not section.startswith('importer'): continue path_format = self.config_store.get(section, 'path_format') if not (path_format and '(' in path_format): continue path_format = path_format.replace('(', '{').replace(')', '}') self.config_store.set(section, 'path_format', path_format) # path format self.path_format = QtWidgets.QLineEdit() self.path_format.setValidator(PathFormatValidator()) self.path_format.textChanged.connect(self.nm.new_format) self.path_format.editingFinished.connect(self.path_format_finished) form.addRow(translate('ImporterTab', 'Target format'), self.path_format) # path example self.path_example = QtWidgets.QLabel() self.nm.new_example.connect(self.path_example.setText) form.addRow('=>', self.path_example) self.layout().addLayout(form, 0, 0) # file list self.file_list_widget = QtWidgets.QListWidget() self.file_list_widget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.file_list_widget.itemSelectionChanged.connect( self.selection_changed) self.layout().addWidget(self.file_list_widget, 1, 0) # selection buttons buttons = QtWidgets.QVBoxLayout() buttons.addStretch(1) self.selected_count = QtWidgets.QLabel() buttons.addWidget(self.selected_count) select_all = QtWidgets.QPushButton( translate('ImporterTab', 'Select\nall')) select_all.clicked.connect(self.select_all) buttons.addWidget(select_all) select_new = QtWidgets.QPushButton( translate('ImporterTab', 'Select\nnew')) select_new.clicked.connect(self.select_new) buttons.addWidget(select_new) # copy buttons self.move_button = StartStopButton( translate('ImporterTab', 'Move\nphotos'), translate('ImporterTab', 'Stop\nmove')) self.move_button.click_start.connect(self.move_selected) self.move_button.click_stop.connect(self.stop_copy) buttons.addWidget(self.move_button) self.copy_button = StartStopButton( translate('ImporterTab', 'Copy\nphotos'), translate('ImporterTab', 'Stop\ncopy')) self.copy_button.click_start.connect(self.copy_selected) self.copy_button.click_stop.connect(self.stop_copy) buttons.addWidget(self.copy_button) self.layout().addLayout(buttons, 0, 1, 2, 1) self.selection_changed() # final initialisation self.image_list.sort_order_changed.connect(self.sort_file_list) path = QtCore.QStandardPaths.writableLocation( QtCore.QStandardPaths.PicturesLocation) self.path_format.setText(os.path.join(path, '%Y', '%Y_%m_%d', '{name}'))
def __init__(self, image_list, parent=None): super(PhotiniMap, self).__init__(parent) self.logger = logging.getLogger(self.__class__.__name__) self.app = QtWidgets.QApplication.instance() self.config_store = self.app.config_store self.image_list = image_list self.multiple_values = multiple_values() self.script_dir = pkg_resources.resource_filename( 'photini', 'data/' + self.__class__.__name__.lower() + '/') self.drag_icon = QtGui.QPixmap( os.path.join(self.script_dir, 'grey_marker.png')) self.location = {} self.search_string = None self.map_loaded = False self.marker_images = {} layout = QtWidgets.QGridLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setRowStretch(6, 1) layout.setColumnStretch(1, 1) self.setLayout(layout) # map self.map = WebView() self.map.setPage(WebPage(parent=self.map)) self.map.setAcceptDrops(False) self.map.page().setLinkDelegationPolicy( QtWebKitWidgets.QWebPage.DelegateAllLinks) self.map.page().linkClicked.connect(self.link_clicked) self.map.page().loadFinished.connect(self.load_finished) self.map.page().mainFrame().javaScriptWindowObjectCleared.connect( self.java_script_window_object_cleared) self.map.drop_text.connect(self.drop_text) self.layout().addWidget(self.map, 0, 1, 8, 1) # search self.layout().addWidget( QtWidgets.QLabel(translate('PhotiniMap', 'Search:')), 0, 0) self.edit_box = QtWidgets.QComboBox() self.edit_box.setMinimumWidth(200) self.edit_box.setEditable(True) self.edit_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.edit_box.lineEdit().setPlaceholderText( translate('PhotiniMap', '<new search>')) self.edit_box.lineEdit().returnPressed.connect(self.search) self.edit_box.activated.connect(self.goto_search_result) self.clear_search() self.edit_box.setEnabled(False) self.layout().addWidget(self.edit_box, 1, 0) # latitude & longitude self.layout().addWidget( QtWidgets.QLabel(translate('PhotiniMap', 'Latitude, longitude:')), 2, 0) self.coords = QtWidgets.QLineEdit() self.coords.editingFinished.connect(self.new_coords) self.coords.setEnabled(False) self.layout().addWidget(self.coords, 3, 0) # load map button self.load_map = QtWidgets.QPushButton( translate('PhotiniMap', '\nLoad map\n')) self.load_map.clicked.connect(self.initialise) self.layout().addWidget(self.load_map, 7, 0) # other init self.image_list.image_list_changed.connect(self.image_list_changed)
def __init__(self, *arg, **kw): super(PicasaUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.widgets = {} ## album details, left hand side album_group = QtWidgets.QGroupBox(self.tr('Collection / Album')) album_group.setLayout(QtWidgets.QHBoxLayout()) album_form_left = QtWidgets.QFormLayout() album_form_left.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_left) # album title / selector self.albums = QtWidgets.QComboBox() self.albums.setEditable(True) self.albums.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.albums.activated.connect(self.switch_album) self.albums.lineEdit().editingFinished.connect(self.new_title) album_form_left.addRow(self.tr('Title'), self.albums) # album description self.widgets['description'] = MultiLineEdit(spell_check=True) self.widgets['description'].editingFinished.connect( self.new_album_details) album_form_left.addRow(self.tr('Description'), self.widgets['description']) # album location self.widgets['location'] = QtWidgets.QLineEdit() self.widgets['location'].editingFinished.connect( self.new_album_details) album_form_left.addRow(self.tr('Place taken'), self.widgets['location']) # album visibility self.widgets['access'] = QtWidgets.QComboBox() self.widgets['access'].addItem(self.tr('Public on the web'), 'public') self.widgets['access'].addItem( self.tr('Limited, anyone with the link'), 'private') self.widgets['access'].addItem(self.tr('Only you'), 'protected') self.widgets['access'].currentIndexChanged.connect(self.new_access) album_form_left.addRow(self.tr('Visibility'), self.widgets['access']) ## album buttons buttons = QtWidgets.QHBoxLayout() buttons.addStretch(stretch=60) album_form_left.addRow(buttons) # new album new_album_button = QtWidgets.QPushButton(self.tr('New album')) new_album_button.clicked.connect(self.new_album) buttons.addWidget(new_album_button, stretch=20) # delete album delete_album_button = QtWidgets.QPushButton(self.tr('Delete album')) delete_album_button.clicked.connect(self.delete_album) buttons.addWidget(delete_album_button, stretch=20) ## album details, right hand side album_form_right = QtWidgets.QFormLayout() album_form_right.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_right) # album date self.widgets['timestamp'] = QtWidgets.QDateEdit() self.widgets['timestamp'].setMinimumDateTime( QtCore.QDateTime.fromTime_t(0)) self.widgets['timestamp'].setCalendarPopup(True) self.widgets['timestamp'].editingFinished.connect( self.new_album_details) album_form_right.addRow(self.tr('Date'), self.widgets['timestamp']) # album thumbnail self.album_thumb = QtWidgets.QLabel() self.album_thumb.setFixedWidth(160) album_form_right.addRow(self.album_thumb) self.layout().addWidget(album_group)
def __init__(self, *arg, **kw): super(FacebookUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.widgets = {} ## upload config config_group = QtWidgets.QGroupBox(self.tr('Options')) config_group.setLayout(QtWidgets.QFormLayout()) self.layout().addWidget(config_group) # suppress feed story self.widgets['no_story'] = QtWidgets.QCheckBox() config_group.layout().addRow(self.tr('Suppress news feed story'), self.widgets['no_story']) label = config_group.layout().labelForField(self.widgets['no_story']) label.setWordWrap(True) label.setFixedWidth(90) # geotagging self.widgets['geo_tag'] = QtWidgets.QCheckBox() config_group.layout().addRow( self.tr('Set "city" from map coordinates'), self.widgets['geo_tag']) self.widgets['geo_tag'].setChecked(True) label = config_group.layout().labelForField(self.widgets['geo_tag']) label.setWordWrap(True) label.setFixedWidth(90) # optimise self.widgets['optimise'] = QtWidgets.QCheckBox() config_group.layout().addRow(self.tr('Optimise image size'), self.widgets['optimise']) label = config_group.layout().labelForField(self.widgets['optimise']) label.setWordWrap(True) label.setFixedWidth(90) if PIL: self.widgets['optimise'].setChecked(True) else: self.widgets['optimise'].setEnabled(False) label.setEnabled(False) ## album details album_group = QtWidgets.QGroupBox(self.tr('Album')) album_group.setLayout(QtWidgets.QHBoxLayout()) # left hand side album_form_left = QtWidgets.QFormLayout() album_form_left.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_left) # album title / selector self.widgets['album_choose'] = QtWidgets.QComboBox() self.widgets['album_choose'].activated.connect(self.select_album) album_form_left.addRow(self.tr('Title'), self.widgets['album_choose']) # album description self.widgets['album_description'] = QtWidgets.QPlainTextEdit() self.widgets['album_description'].setReadOnly(True) policy = self.widgets['album_description'].sizePolicy() policy.setVerticalStretch(1) self.widgets['album_description'].setSizePolicy(policy) album_form_left.addRow(self.tr('Description'), self.widgets['album_description']) # album location self.widgets['album_location'] = QtWidgets.QLineEdit() self.widgets['album_location'].setReadOnly(True) album_form_left.addRow(self.tr('Location'), self.widgets['album_location']) # right hand side album_form_right = QtWidgets.QVBoxLayout() album_group.layout().addLayout(album_form_right) # album thumbnail self.widgets['album_thumb'] = QtWidgets.QLabel() self.widgets['album_thumb'].setFixedSize(150, 150) self.widgets['album_thumb'].setAlignment(Qt.AlignHCenter | Qt.AlignTop) album_form_right.addWidget(self.widgets['album_thumb']) album_form_right.addStretch(1) # new album new_album_button = QtWidgets.QPushButton(self.tr('New album')) new_album_button.clicked.connect(self.new_album) album_form_right.addWidget(new_album_button) self.layout().addWidget(album_group, stretch=1)
def __init__(self, image_list, parent=None): super(TabWidget, self).__init__(parent) app = QtWidgets.QApplication.instance() app.aboutToQuit.connect(self.shutdown) if gp and app.test_mode: self.gp_log = gp.check_result(gp.use_python_logging()) self.config_store = app.config_store self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) form = QtWidgets.QFormLayout() form.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.nm = NameMangler() self.file_data = {} self.file_list = [] self.source = None self.file_copier = None # source selector box = QtWidgets.QHBoxLayout() box.setContentsMargins(0, 0, 0, 0) self.source_selector = QtWidgets.QComboBox() self.source_selector.currentIndexChanged.connect(self.new_source) box.addWidget(self.source_selector) refresh_button = QtWidgets.QPushButton(self.tr('refresh')) refresh_button.clicked.connect(self.refresh) box.addWidget(refresh_button) box.setStretch(0, 1) form.addRow(self.tr('Source'), box) # path format self.path_format = QtWidgets.QLineEdit() self.path_format.setValidator(PathFormatValidator()) self.path_format.textChanged.connect(self.nm.new_format) self.path_format.editingFinished.connect(self.path_format_finished) form.addRow(self.tr('Target format'), self.path_format) # path example self.path_example = QtWidgets.QLabel() self.nm.new_example.connect(self.path_example.setText) form.addRow('=>', self.path_example) self.layout().addLayout(form, 0, 0) # file list self.file_list_widget = QtWidgets.QListWidget() self.file_list_widget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.file_list_widget.itemSelectionChanged.connect( self.selection_changed) self.layout().addWidget(self.file_list_widget, 1, 0) # selection buttons buttons = QtWidgets.QVBoxLayout() buttons.addStretch(1) self.selected_count = QtWidgets.QLabel() buttons.addWidget(self.selected_count) select_all = QtWidgets.QPushButton(self.tr('Select\nall')) select_all.clicked.connect(self.select_all) buttons.addWidget(select_all) select_new = QtWidgets.QPushButton(self.tr('Select\nnew')) select_new.clicked.connect(self.select_new) buttons.addWidget(select_new) # copy buttons self.move_button = StartStopButton(self.tr('Move\nphotos'), self.tr('Stop\nmove')) self.move_button.click_start.connect(self.move_selected) self.move_button.click_stop.connect(self.stop_copy) buttons.addWidget(self.move_button) self.copy_button = StartStopButton(self.tr('Copy\nphotos'), self.tr('Stop\ncopy')) self.copy_button.click_start.connect(self.copy_selected) self.copy_button.click_stop.connect(self.stop_copy) buttons.addWidget(self.copy_button) self.layout().addLayout(buttons, 0, 1, 2, 1) self.selection_changed() # final initialisation self.image_list.sort_order_changed.connect(self.sort_file_list) if qt_version_info >= (5, 0): path = QtCore.QStandardPaths.writableLocation( QtCore.QStandardPaths.PicturesLocation) else: path = QtGui.QDesktopServices.storageLocation( QtGui.QDesktopServices.PicturesLocation) self.path_format.setText(os.path.join(path, '%Y', '%Y_%m_%d', '{name}')) self.refresh() self.list_files()