aboutsummaryrefslogtreecommitdiffstats
path: root/tagit/windows
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-02-17 08:25:44 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-02-17 08:25:44 +0100
commit580caf6f5c9b795f9c38b9c970efce12d006ce1d (patch)
tree24afb74d772ae44326b3e4d542598ef96ef1900f /tagit/windows
parentbf98c062ece242a5fc56de0f1adbc12f0588809a (diff)
downloadtagit-580caf6f5c9b795f9c38b9c970efce12d006ce1d.tar.gz
tagit-580caf6f5c9b795f9c38b9c970efce12d006ce1d.tar.bz2
tagit-580caf6f5c9b795f9c38b9c970efce12d006ce1d.zip
New UI design
* Moved style definitions to its own file (themes/default) * Updated the desktop.kv to the new UI design * Removed planes * Adjusted port config
Diffstat (limited to 'tagit/windows')
-rw-r--r--tagit/windows/desktop.kv145
-rw-r--r--tagit/windows/desktop.py35
2 files changed, 72 insertions, 108 deletions
diff --git a/tagit/windows/desktop.kv b/tagit/windows/desktop.kv
index cbc5c48..685cc10 100644
--- a/tagit/windows/desktop.kv
+++ b/tagit/windows/desktop.kv
@@ -1,13 +1,9 @@
+#:import TileDecorationRoundedBorder tagit.tiles.decoration.TileDecorationRoundedBorder
#:import TileDecorationBorder tagit.tiles.decoration.TileDecorationBorder
#:import TileDecorationFilledRectangle tagit.tiles.decoration.TileDecorationFilledRectangle
-# DEBUG: Draw borders around all widgets
-#<Widget>:
-# canvas.after:
-# Line:
-# rectangle: self.x+1,self.y+1,self.width-1,self.height-1
-# dash_offset: 5
-# dash_length: 3
+<HGuide@Widget>:
+
<MainWindow>:
# main content
@@ -15,110 +11,89 @@
browser: browser
filter: filter
status: status
- # required by actions.planes
- planes: planes
# required by Menu
context: context
- Carousel:
- id: planes
- loop: True
- scroll_timeout: 0 # disables switching by touch event
- # plane references
- dashboard: dashboard
- browsing: browsing
- codash: codash
+ BoxLayout:
+ orientation: 'vertical'
- # planes
+ Widget:
+ height: 5
+ size_hint: 1, None
- TileDock: # static dashboard plane
- id: dashboard
+ Filter:
+ id: filter
root: root
- # plane config
- size_hint: 1, 1
- visible: planes.current_slide == self
- # dock config
- name: 'dashboard'
- decoration: TileDecorationBorder
- cols: 3
- rows: 2
- # self.size won't be updated correctly
- tile_width: self.width / self.cols
- tile_height: self.height / self.rows
-
- BoxLayout: # browsing plane
- id: browsing
+ size_hint: 1, None
+ height: 30
+
+ HGuide:
+ height: 20
+ size_hint: 1, None
+
+ Widget: # spacer
+ height: 20
+ size_hint: 1, None
+
+ BoxLayout:
orientation: 'horizontal'
- visible: planes.current_slide == self
ButtonDock: # one column of buttons on the left
root: root
- orientation: 'tb-lr'
+ orientation: 'lr-tb'
# one column of buttons
- width: 30 + 2*10
+ width: 1*30 + 2*10
name: 'sidebar_left'
spacing: 10
padding: 10
- size_hint: None, 1
+ size_hint: None, None
button_height: 30
button_show: 'image',
+ # adjust height automatically to content
+ height: self.minimum_height
+ pos_hint: {'center_y': 0.5}
- BoxLayout: # main content
- orientation: 'vertical'
+ Widget: # spacer
+ width: 20 # ButtonDock already has a space of 10px
+ size_hint: None, 1
+
+ Browser: # browsing space
+ id: browser
+ root: root
size_hint: 1, 1
- BoxLayout:
- orientation: 'horizontal'
- size_hint: 1, 1
- current: 0
-
- BoxLayout:
- orientation: 'vertical'
- size_hint: 1, 1
-
- Filter:
- id: filter
- root: root
- size_hint: 1, None
- height: 30
-
- Browser:
- id: browser
- root: root
- size_hint: 1, 0.96
-
- Status:
- id: status
- root: root
- size_hint: 1, None
- height: 30
-
+ Widget: # spacer
+ width: 30
+ size_hint: None, 1
+
TileDock: # context info to the right
root: root
- visible: planes.current_slide == self.parent
name: 'sidebar_right'
- decoration: TileDecorationFilledRectangle
+ decoration: TileDecorationRoundedBorder
+ visible: True
cols: 1
- rows: 3
+ rows: 1
+ width: 220
+ size_hint: None, None
# self.height won't be updated correctly
#tile_height: self.size[1] / 4
- width: 180
- size_hint: None, 1
-
- TileDock: # contextual dashboard
- id: codash
+ #height: sum(tile.client.default_size[1] for tile in self.children)
+ height: self.parent.height / 2
+ pos_hint: {'center_y': 0.5}
+
+ Widget: # spacer
+ height: 20
+ size_hint: 1, None
+
+ HGuide:
+ height: 20
+ size_hint: 1, None
+
+ Status:
+ id: status
root: root
- # plane config
- size_hint: 1, 1
- visible: planes.current_slide == self
- # dock config
- name: 'codash'
- decoration: TileDecorationBorder
- cols: 4
- rows: 2
- # self.size won't be update correctly
- tile_width: self.width / 4
- tile_height: self.height / 2
+ size_hint: 1, None
+ height: 30
Context: # context menu
id: context
diff --git a/tagit/windows/desktop.py b/tagit/windows/desktop.py
index 42b279e..60e23d4 100644
--- a/tagit/windows/desktop.py
+++ b/tagit/windows/desktop.py
@@ -17,8 +17,9 @@ from kivy.uix.floatlayout import FloatLayout
import kivy.properties as kp
# import Image and Loader to overwrite their caches later on
-from kivy.loader import Loader
from kivy.cache import Cache
+from kivy.loader import Loader
+from kivy.resources import resource_find
# tagit imports
from tagit import actions, config, dialogues
@@ -44,6 +45,8 @@ logger = logging.getLogger(__name__)
# load kv
Builder.load_file(os.path.join(os.path.dirname(__file__), 'desktop.kv'))
+# load styles
+Builder.load_file(resource_find('default/style.kv'))
# classes
class MainWindow(FloatLayout):
@@ -80,6 +83,9 @@ class MainWindow(FloatLayout):
# bind pre-close checks
from kivy.core.window import Window
Window.bind(on_request_close=self.on_request_close)
+ Window.size = tuple(cfg('ui', 'standalone', 'window_size'))
+ if cfg('ui', 'standalone', 'maximize'):
+ Window.maximize()
## properties
@@ -96,14 +102,6 @@ class MainWindow(FloatLayout):
## startup and shutdown
def on_startup(self):
- # switch to starting plane - if it's the dashboard no action is needed
- if self.session.cfg('ui', 'standalone', 'plane') == 'browsing':
- self.trigger('ShowBrowsing')
-
- # show welcome message
- if self.session.cfg('session', 'first_start'): # FIXME: mb/port: move to starting app
- self.display_welcome()
-
# run script
for args in self.session.cfg('session', 'script'):
if isinstance(args, str):
@@ -129,29 +127,20 @@ class MainWindow(FloatLayout):
#App.get_running_app().stop() # FIXME: mb/port: from CloseSessionAndExit
return False
- def display_welcome(self):
- """Display a welcome dialogue on the first start."""
- message = """
-[size=20sp]Welcome to [b]tagit[/b]![/size]
-
-Since you see this message, it's time to configure tagit. It's a good idea to get familiar with the configuration. Hit F1 or the config button to see all relevant settings. There, you can also get rid of this message. If you desire more flexibility, you can edit the config file directly. Check out the project homepage for more details.
-""" # FIXME!
- dialogues.Message(text=message, align='left').open()
-
## config ##
-config.declare(('session', 'first_start'), config.Bool(), True,
- __name__, 'First start', 'Show the welcome message typically shown when tagit is started the first time.')
-
config.declare(('session', 'script'), config.List(config.Any()), [],
__name__, 'start script', 'Actions to run after startup. Intended for testing.')
config.declare(('session', 'script_delay'), config.Unsigned(), 0,
__name__, 'script delay', 'Start script execution delay in seconds.')
-config.declare(('ui', 'standalone', 'plane'), config.Enum('browsing', 'dashboard'), 'dashboard',
- __name__, 'Initial plane', 'Start with the dashboard or browsing plane.')
+config.declare(('ui', 'standalone', 'maximize'), config.Bool(), False,
+ __name__, 'Window maximization', 'Maximize the window upon startup.')
+
+config.declare(('ui', 'standalone', 'window_size'), config.List(config.Unsigned()), (1024, 768),
+ __name__, 'Wndow size', 'Set the window size upon startup.')
config.declare(('ui', 'standalone', 'browser', 'cache_size'), config.Unsigned(), 1000,
__name__, 'Cache size', 'Number of preview images that are held in the cache. Should be high or zero if memory is not an issue. Set to a small value to preserve memory, but should be at least the most common page size. It is advised to set a value in accordance with `ui.standalone.browser.cache_items`. If zero, no limit applies.')