Skip to content

Commit

Permalink
Use per-app screenshots in AppData
Browse files Browse the repository at this point in the history
Issue: #5

Signed-off-by: Jiří Janoušek <[email protected]>
  • Loading branch information
jiri-janousek committed Nov 10, 2018
1 parent 2eb4a49 commit ee96346
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions nuvolasdk/appdata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright 2016-2017 Jiří Janoušek <[email protected]>
Copyright 2016-2018 Jiří Janoušek <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -114,8 +114,9 @@ def create_app_data_xml(meta, genuine):
tree.add("p", para)
tree.add("p", LEGAL.strip().format(name=meta["name"]))
with tree("screenshots"):
for i, (url, caption) in enumerate(screenshots.SCREENSHOTS):
args = {"type": "default"} if i == 0 else {}
for i, (filename, _bounds, _fill, caption) in enumerate(screenshots.BASE_SCREENSHOTS[screenshots.DEFAULT_KIND]):
url = screenshots.HOSTED_SCREENSHOTS_WEB_ROOT + app_id + "/" + filename
args = {"type": "default"} if i == 0 else {}
with tree("screenshot", **args):
tree.add("image", url)
tree.add("caption", caption)
Expand Down
4 changes: 2 additions & 2 deletions nuvolasdk/createscreenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def create_arg_parser(prog):
def run(directory, prog, argv):
args = create_arg_parser(prog).parse_args(argv)
output_dir = abspath(args.output_dir or directory)
kind = args.kind or 'other'
kind = args.kind or screenshots.DEFAULT_KIND
web_view_screenshot = abspath(args.input)
screenshots_dir = utils.get_sdk_data_dir('screenshots')
mkdirs(output_dir)
for base, bounds, fill in screenshots.BASE_SCREENSHOTS[kind]:
for base, bounds, fill, _caption in screenshots.BASE_SCREENSHOTS[kind]:
input_path = joinpath(screenshots_dir, base)
output_path = joinpath(output_dir, base)
print("'%s' → '%s'" % (input_path, output_path))
Expand Down
10 changes: 7 additions & 3 deletions nuvolasdk/screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@
),
]

HOSTED_SCREENSHOTS_WEB_ROOT = 'https://nuvola.tiliado.eu/screenshots/apps/'

DEFAULT_KIND = 'other'

BASE_SCREENSHOTS = {
'other': [
('pantheon.png', '90,80+1080,600', '#c1c1c1'),
('unity.png', '108,106+1080,600', '#c1c1c1'),
('gnome.png', '117,87+1080,600', '#c1c1c1'),
('gnome.png', '117,87+1080,600', '#c1c1c1', 'Integration with GNOME desktop environment.'),
('unity.png', '108,106+1080,600', '#c1c1c1', 'Integration with Unity desktop environment.'),
('pantheon.png', '90,80+1080,600', '#c1c1c1', 'Integration with Pantheon desktop environment.'),
]
}

0 comments on commit ee96346

Please sign in to comment.