From 23e2846a60322487d4b72d2d6dd0685c58c601c1 Mon Sep 17 00:00:00 2001 From: Insality Date: Mon, 21 Sep 2020 23:28:20 +0300 Subject: [PATCH] Move components to extended. Make stubs for ready to make it requirable --- druid/{base => extended}/checkbox.lua | 0 druid/{base => extended}/checkbox_group.lua | 0 .../{base => extended}/component.template.lua | 0 druid/{base => extended}/input.lua | 0 druid/{base => extended}/progress.lua | 0 druid/{base => extended}/radio_group.lua | 0 druid/{base => extended}/slider.lua | 0 druid/{base => extended}/timer.lua | 0 druid/helper.lua | 9 ++ druid/system/druid_instance.lua | 94 ++++++++++--------- settings_deployer | 2 +- 11 files changed, 61 insertions(+), 44 deletions(-) rename druid/{base => extended}/checkbox.lua (100%) rename druid/{base => extended}/checkbox_group.lua (100%) rename druid/{base => extended}/component.template.lua (100%) rename druid/{base => extended}/input.lua (100%) rename druid/{base => extended}/progress.lua (100%) rename druid/{base => extended}/radio_group.lua (100%) rename druid/{base => extended}/slider.lua (100%) rename druid/{base => extended}/timer.lua (100%) diff --git a/druid/base/checkbox.lua b/druid/extended/checkbox.lua similarity index 100% rename from druid/base/checkbox.lua rename to druid/extended/checkbox.lua diff --git a/druid/base/checkbox_group.lua b/druid/extended/checkbox_group.lua similarity index 100% rename from druid/base/checkbox_group.lua rename to druid/extended/checkbox_group.lua diff --git a/druid/base/component.template.lua b/druid/extended/component.template.lua similarity index 100% rename from druid/base/component.template.lua rename to druid/extended/component.template.lua diff --git a/druid/base/input.lua b/druid/extended/input.lua similarity index 100% rename from druid/base/input.lua rename to druid/extended/input.lua diff --git a/druid/base/progress.lua b/druid/extended/progress.lua similarity index 100% rename from druid/base/progress.lua rename to druid/extended/progress.lua diff --git a/druid/base/radio_group.lua b/druid/extended/radio_group.lua similarity index 100% rename from druid/base/radio_group.lua rename to druid/extended/radio_group.lua diff --git a/druid/base/slider.lua b/druid/extended/slider.lua similarity index 100% rename from druid/base/slider.lua rename to druid/extended/slider.lua diff --git a/druid/base/timer.lua b/druid/extended/timer.lua similarity index 100% rename from druid/base/timer.lua rename to druid/extended/timer.lua diff --git a/druid/helper.lua b/druid/helper.lua index 1e1076f8..12a1b179 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -188,4 +188,13 @@ function M.get_border(node) ) end + +-- Show message to require extended component +function M.extended_component(component_name) + print(string.format("[Druid]: The component %s is extended component. You have to register it via druid.register to use it", component_name)) + print("[Druid]: Use next code:") + print(string.format('local %s = require("druid.extended.%s")', component_name, component_name)) + print(string.format('druid.register("%s", %s)', component_name, component_name)) +end + return M diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 0b1191c5..259f49b3 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -19,28 +19,29 @@ -- @see druid.drag local const = require("druid.const") +local helper = require("druid.helper") local druid_input = require("druid.helper.druid_input") local settings = require("druid.system.settings") local class = require("druid.system.middleclass") -local button = require("druid.base.button") -local blocker = require("druid.base.blocker") local back_handler = require("druid.base.back_handler") +local blocker = require("druid.base.blocker") +local button = require("druid.base.button") +local drag = require("druid.base.drag") +local grid = require("druid.base.grid") local hover = require("druid.base.hover") -local text = require("druid.base.text") local lang_text = require("druid.base.lang_text") -local timer = require("druid.base.timer") -local progress = require("druid.base.progress") -local grid = require("druid.base.grid") local scroll = require("druid.base.scroll") -local slider = require("druid.base.slider") -local checkbox = require("druid.base.checkbox") -local checkbox_group = require("druid.base.checkbox_group") -local radio_group = require("druid.base.radio_group") -local input = require("druid.base.input") local swipe = require("druid.base.swipe") -local drag = require("druid.base.drag") --- local infinity_scroll = require("druid.base.infinity_scroll") +local text = require("druid.base.text") + +local checkbox = require("druid.extended.checkbox") +local checkbox_group = require("druid.extended.checkbox_group") +local input = require("druid.extended.input") +local progress = require("druid.extended.progress") +local radio_group = require("druid.extended.radio_group") +local slider = require("druid.extended.slider") +local timer = require("druid.extended.timer") -- @classmod Druid local Druid = class("druid.druid_instance") @@ -384,24 +385,6 @@ function Druid.new_lang_text(self, ...) end ---- Create timer basic component --- @function druid:new_timer --- @tparam args ... timer init args --- @treturn Component timer component -function Druid.new_timer(self, ...) - return Druid.create(self, timer, ...) -end - - ---- Create progress basic component --- @function druid:new_progress --- @tparam args ... progress init args --- @treturn Component progress component -function Druid.new_progress(self, ...) - return Druid.create(self, progress, ...) -end - - --- Create grid basic component -- @function druid:new_grid -- @tparam args ... grid init args @@ -420,11 +403,30 @@ function Druid.new_scroll(self, ...) end +--- Create swipe basic component +-- @function druid:new_swipe +-- @tparam args ... swipe init args +-- @treturn Component swipe component +function Druid.new_swipe(self, ...) + return Druid.create(self, swipe, ...) +end + + +--- Create drag basic component +-- @function druid:new_drag +-- @tparam args ... drag init args +-- @treturn Componetn drag component +function Druid.new_drag(self, ...) + return Druid.create(self, drag, ...) +end + + --- Create slider basic component -- @function druid:new_slider -- @tparam args ... slider init args -- @treturn Component slider component function Druid.new_slider(self, ...) + -- return helper.extended_component("slider") return Druid.create(self, slider, ...) end @@ -434,6 +436,7 @@ end -- @tparam args ... checkbox init args -- @treturn Component checkbox component function Druid.new_checkbox(self, ...) + -- return helper.extended_component("checkbox") return Druid.create(self, checkbox, ...) end @@ -443,6 +446,7 @@ end -- @tparam args ... input init args -- @treturn Component input component function Druid.new_input(self, ...) + -- return helper.extended_component("input") return Druid.create(self, input, ...) end @@ -452,6 +456,7 @@ end -- @tparam args ... checkbox_group init args -- @treturn Component checkbox_group component function Druid.new_checkbox_group(self, ...) + -- return helper.extended_component("checkbox_group") return Druid.create(self, checkbox_group, ...) end @@ -461,25 +466,28 @@ end -- @tparam args ... radio_group init args -- @treturn Component radio_group component function Druid.new_radio_group(self, ...) + -- return helper.extended_component("radio_group") return Druid.create(self, radio_group, ...) end ---- Create swipe basic component --- @function druid:new_swipe --- @tparam args ... swipe init args --- @treturn Component swipe component -function Druid.new_swipe(self, ...) - return Druid.create(self, swipe, ...) +--- Create timer basic component +-- @function druid:new_timer +-- @tparam args ... timer init args +-- @treturn Component timer component +function Druid.new_timer(self, ...) + -- return helper.extended_component("timer") + return Druid.create(self, timer, ...) end ---- Create drag basic component --- @function druid:new_drag --- @tparam args ... drag init args --- @treturn Componetn drag component -function Druid.new_drag(self, ...) - return Druid.create(self, drag, ...) +--- Create progress basic component +-- @function druid:new_progress +-- @tparam args ... progress init args +-- @treturn Component progress component +function Druid.new_progress(self, ...) + -- return helper.extended_component("progress") + return Druid.create(self, progress, ...) end diff --git a/settings_deployer b/settings_deployer index 5625ee76..de288e76 100644 --- a/settings_deployer +++ b/settings_deployer @@ -1,2 +1,2 @@ #!/bin/bash -use_latest_bob=true +use_latest_bob=false