Skip to content

Commit

Permalink
Save and restore last used directory in file chooser; Issue #29
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Jun 13, 2020
1 parent 3e88bf7 commit ce53179
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 295 deletions.
11 changes: 11 additions & 0 deletions default_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

display:
dark_mode: false
# Not yet configurable
md_primary_palette: 'Teal'
md_accent_palette: 'Cyan'
inaturalist:
locale: null
preferred_place_id: 1
Expand All @@ -11,3 +14,11 @@ metadata:
create_xmp: true
darwin_core: true
hierarchical_keywords: true
photos:
start_dir: '/'
# Not yet configurable
filetypes: ['jpg', 'jpeg', 'png', 'gif']
# Not yet configurable
search:
autocomplete_delay: 0.5
autocomplete_min_chars: 3
25 changes: 5 additions & 20 deletions kv/image_selection.kv
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,14 @@
orientation: 'vertical'
md_bg_color: .1, .1, .1, .75
FileChooserListView:
rootpath: 'D:\\NextCloud\\Photos' # TODO: remove, just for debugging
id: file_chooser
dirselect: True
filters: IMAGE_FILETYPES

# List of selected files
MDBoxLayout:
orientation: 'vertical'
md_bg_color: app.theme_cls.primary_color

MDLabel:
text: 'Selected Files:'
size_hint_max_y: dp(20)
TextInput:
id: file_list_text_box
readonly: True
multiline: True
size_hint_y: .3

# Buttons; TODO: Make this less ugly
MDBoxLayout:
size_hint_y: None
height: dp(30)
height: dp(50)
spacing: dp(5)

MDRaisedButton:
Expand All @@ -95,10 +80,10 @@
height: dp(50)
theme_text_color: 'Primary'
md_bg_color: app.theme_cls.accent_color
# MDRaisedButton:
# id: debug_button
# text: 'Debug'
# md_bg_color: app.theme_cls.accent_color
# MDRaisedButton:
# id: debug_button
# text: 'Debug'
# md_bg_color: app.theme_cls.accent_color
MDRaisedButton:
id: load_button
text: 'Load Selected File/Folder'
Expand Down
12 changes: 11 additions & 1 deletion kv/context_menus.kv → kv/menus.kv
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
PhotoContextMenuItem:
id: remove_ctx
text: "Remove from selection"
# Just some ideas for future features
# Just some ideas for future features
# ContextMenuDivider:
# text: "Taxon"
# PhotoContextMenuItem:
# id: view_taxon_ctx
# text: "View taxon"
# disabled: True
# PhotoContextMenuItem:
# text: "View taxon on iNaturalist"
# disabled: True
# Or maybe nested menus:
# ContextMenuDivider:
# text: "More options"
# ContextMenuTextItem:
Expand Down
2 changes: 2 additions & 0 deletions naturtag/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ def init_controllers(self, screens):
self.select_taxon = self.taxon_view_controller.select_taxon
self.select_taxon_from_photo = self.image_selection_controller.select_taxon_from_photo
self.update_history = self.taxon_selection_controller.update_history
self.add_control_widget = self.settings_controller.add_control_widget

# Proxy properties
self.stored_taxa = self.settings_controller.stored_taxa
self.locale = self.settings_controller.locale
self.metadata = self.settings_controller.metadata
self.preferred_place_id = self.settings_controller.preferred_place_id

self.image_selection_controller.post_init()
self.taxon_selection_controller.post_init()

def get_taxon_list_item(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion naturtag/app/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'widgets',
'main',
# 'autocomplete',
'context_menus',
'menus',
'taxon_search',
'taxon_selection',
]
Expand Down
236 changes: 0 additions & 236 deletions naturtag/app/testapp.py

This file was deleted.

10 changes: 5 additions & 5 deletions naturtag/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from collections import OrderedDict
from os.path import dirname, join
from appdirs import user_data_dir
from naturtag import __version__
from pyinaturalist import DEFAULT_USER_AGENT
from pyinaturalist.constants import RANKS
#RANKS + ['infraclass']

Expand Down Expand Up @@ -47,16 +49,14 @@
# Config files
CONFIG_PATH = join(DATA_DIR, 'settings.yml')
DEFAULT_CONFIG_PATH = join(PKG_DIR, 'default_settings.yml')

STORED_TAXA_PATH = join(DATA_DIR, 'stored_taxa.json')
TAXON_HISTORY_PATH = join(DATA_DIR, 'taxon_history')
TAXON_FREQUENCY_PATH = join(DATA_DIR, 'taxon_frequency.json')
STARRED_TAXA_PATH = join(DATA_DIR, 'starred_taxa')
MAX_DISPLAY_HISTORY = 25 # Max number of history items to display at a time

# URLs
# URLs / API settings
TAXON_BASE_URL = 'https://www.inaturalist.org/taxa'
OBSERVATION_BASE_URL = 'https://www.inaturalist.org/observations'
PLACES_BASE_URL = 'https://www.inaturalist.org/places'
USER_AGENT = f'naturtag/{__version__}; {DEFAULT_USER_AGENT}'.lower()

# Theme/window settings
INIT_WINDOW_POSITION = ('custom', 100, 100)
Expand Down

0 comments on commit ce53179

Please sign in to comment.