Skip to content

Commit 9ee114f

Browse files
committed
feat: ajout de la fonction createPluginHeader dans UIHelpers pour simplifier l'affichage de l'en-tête du plugin #38
1 parent 8258568 commit 9ee114f

3 files changed

Lines changed: 73 additions & 51 deletions

File tree

piwigoPublish.lrplugin/PWExtraOptions.lua

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
]]
2222

23+
require "UIHelpers"
24+
2325
-- *************************************************
2426
-- Define a value_equal function for the popup_menu
2527
local function valueEqual(a, b)
@@ -64,31 +66,7 @@ local function main()
6466
local c = f:column {
6567
spacing = f:dialog_spacing(),
6668

67-
f:row {
68-
f:picture {
69-
alignment = 'left',
70-
value = iconPath,
71-
},
72-
f:column {
73-
spacing = f:control_spacing(),
74-
f:spacer { height = 1 },
75-
f:row {
76-
f:static_text {
77-
title = "Piwigo Publisher Plugin",
78-
font = "<system/bold>",
79-
alignment = 'left',
80-
width = share 'labelWidth',
81-
},
82-
},
83-
f:row {
84-
f:static_text {
85-
title = " Plugin Version " .. pluginVersion,
86-
alignment = 'left',
87-
width = share 'labelWidth',
88-
},
89-
},
90-
},
91-
},
69+
UIHelpers.createPluginHeader(f, share, iconPath, pluginVersion),
9270

9371
f:row {
9472
spacing = f:label_spacing(),

piwigoPublish.lrplugin/PublishDialogSections.lua

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
along with this program. If not, see <http://www.gnu.org/licenses/>.
2323
]]
2424

25+
require "UIHelpers"
26+
2527
PublishDialogSections = {}
2628

2729
-- *************************************************
@@ -61,32 +63,7 @@ local function connectionDialog(f, propertyTable, pwInstance)
6163
bind_to_object = propertyTable,
6264

6365
-- TOP: icon + version block
64-
f:row {
65-
f:picture {
66-
alignment = 'left',
67-
value = iconPath,
68-
--value = _PLUGIN:resourceId("icons/icon_med.png"),
69-
},
70-
f:column {
71-
spacing = f:control_spacing(),
72-
f:spacer { height = 1 },
73-
f:row {
74-
f:static_text {
75-
title = "Piwigo Publisher Plugin",
76-
font = "<system/bold>",
77-
alignment = 'left',
78-
width = share 'labelWidth',
79-
},
80-
},
81-
f:row {
82-
f:static_text {
83-
title = " Plugin Version " .. pluginVersion,
84-
alignment = 'left',
85-
width = share 'labelWidth',
86-
},
87-
},
88-
},
89-
},
66+
UIHelpers.createPluginHeader(f, share, iconPath, pluginVersion),
9067

9168
-- PW Host
9269
f:spacer { height = 1 },
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
--[[
2+
3+
UIHelpers.lua
4+
5+
UI Helper Functions for Piwigo Publisher plugin
6+
7+
Copyright (C) 2024 Fiona Boston <fiona@fbphotography.uk>.
8+
9+
This file is part of PiwigoPublish
10+
11+
This program is free software: you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published by
13+
the Free Software Foundation; either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
This program is distributed in the hope that it will be useful,
17+
but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
GNU General Public License for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
]]
24+
25+
UIHelpers = {}
26+
27+
-- *************************************************
28+
-- Create plugin header with icon and version information
29+
-- Returns a row containing icon + plugin name + version
30+
-- *************************************************
31+
function UIHelpers.createPluginHeader(f, share, iconPath, pluginVersion)
32+
local INDENT_PIXELS = 14
33+
34+
return f:row {
35+
f:picture {
36+
alignment = 'left',
37+
value = iconPath,
38+
},
39+
f:column {
40+
spacing = f:control_spacing(),
41+
f:spacer { height = 1 },
42+
f:row {
43+
f:spacer { width = INDENT_PIXELS },
44+
f:static_text {
45+
title = "Piwigo Publisher Plugin",
46+
font = "<system/bold>",
47+
alignment = 'left',
48+
width = share 'labelWidth',
49+
},
50+
},
51+
f:row {
52+
f:spacer { width = INDENT_PIXELS },
53+
f:static_text {
54+
title = "Plugin Version",
55+
alignment = 'left',
56+
},
57+
f:static_text {
58+
title = pluginVersion,
59+
alignment = 'left',
60+
width = share 'labelWidth',
61+
},
62+
},
63+
},
64+
}
65+
end
66+
67+
return UIHelpers

0 commit comments

Comments
 (0)