Skip to content

Commit c8713a7

Browse files
committed
cleanup the code and create UI elements before
1 parent 73e274c commit c8713a7

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

contrib/copy_attach_detach_tags.lua

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -144,42 +144,44 @@ end
144144
-- create modul Tagging addons
145145
taglist_label.reset_callback = mcopy_tags
146146

147-
dt.register_lib("tagging_addon","Tagging addon",true,false,{
148-
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",500}
149-
},
150-
dt.new_widget("box")
151-
{
152-
orientation = "vertical",
153-
dt.new_widget("button")
154-
{
147+
-- create buttons and elements
148+
local mc_button = dt.new_widget("button") {
155149
label = "multi copy tags",
156-
clicked_callback = mcopy_tags
157-
},
158-
dt.new_widget("button")
159-
{
150+
clicked_callback = mcopy_tags}
151+
152+
local p_button = dt.new_widget("button") {
160153
label = "paste tags",
161-
clicked_callback = attach_tags
162-
},
163-
dt.new_widget("button")
164-
{
154+
clicked_callback = attach_tags}
155+
156+
local rep_button = dt.new_widget("button") {
165157
label = "replace tags",
166-
clicked_callback = replace_tags
167-
},
168-
dt.new_widget("button")
169-
{
158+
clicked_callback = replace_tags}
159+
160+
local rem_button = dt.new_widget("button") {
170161
label = "remove all tags",
171-
clicked_callback = detach_tags
172-
},
173-
dt.new_widget("label")
174-
{
162+
clicked_callback = detach_tags}
163+
164+
local taglabel = dt.new_widget("label") {
175165
label = "tag clipboard",
176166
selectable = false,
177167
ellipsize = "middle",
178-
halign = "start"
179-
},
180-
dt.new_widget("separator"){},
181-
taglist_label
182-
},
168+
halign = "start"}
169+
170+
171+
-- create modul
172+
dt.register_lib("tagging_addon","Tagging addon",true,false,{
173+
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",500}
174+
},
175+
dt.new_widget("box") {
176+
orientation = "vertical",
177+
mc_button,
178+
p_button,
179+
rep_button,
180+
rem_button,
181+
taglabel,
182+
dt.new_widget("separator"){},
183+
taglist_label
184+
},
183185
nil,
184186
nil
185187
)

0 commit comments

Comments
 (0)