Re: [darktable-dev] Lua combobox bug?
>From what I remember, when I was dynamically changing combobox values, you can add to the end of the table, or remove from the end of the table, or change the name of a value in the table. If you want to remove a string from anywhere but the end, you have to rewrite the whole table of values without the one you want to remove, then remove the extra values from the end, which is how update_combobox_choices() came about. The other problem is that you can't create a table of values then do my_combobox = dt.new_widget("combobox") { value = 1, table.unpack(table_of_values) } so if you have to determine the combobox values at run time and then load them, you either have to loop and load them one at a time or use update_combobox_choices() which does it for you. Bill On Thu, May 4, 2017 at 5:09 PM, William Ferguson wrote: > Thank you Christian. I was going to write an example similar to yours but > didn't have time at the moment. > > Bill > > On May 4, 2017 3:03 PM, "Christian Kanzian" > wrote: > >> Am Donnerstag, 4. Mai 2017, 20:02:02 CEST schrieb Holger Klemm: >> > Thanks for the function. I do not understand how I must use that :-( >> > choice_table? >> >> AFAIK a combobox stores its entries like a lua table with indices. >> Updating lua table entries can only be done be looping over the entries? >> That >> is what Bill suggest in his reply. >> >> Merging your test.lua with Bill's answer like that works for me: >> >> local dt = require "darktable" >> >> test_combobox = dt.new_widget("combobox") >> { >> label = 'test combobox', >> tooltip ='', >> value = 1, >> editable=true, >> "1","2","3","4","5", >> reset_callback = function(self_reset) >>self_reset.value = 1 >> end >> } >> >> >> local function update_combobox_choices(combobox, choice_table, selected) >> local items = #combobox >> local choices = #choice_table >> for i, name in ipairs(choice_table) do >> combobox[i] = name >> end >> if choices < items then >> for j = items, choices + 1, -1 do >> combobox[j] = nil >> end >> end >> combobox.value = selected >> end >> >> local new_choices = {"XX","YY"} >> >> add_button = dt.new_widget("button") >> { >> label = 'change combobox', >> clicked_callback = function (x) >> update_combobox_choices(test_combobox,new_choices,2) >> dt.print("combobox changed") >> end >> } >> >> >> local import_widget = dt.new_widget("box") { >> test_combobox, >> add_button, >> >> } >> >> Christian >> >> > >> > Am Mittwoch, 3. Mai 2017, 15:55:42 CEST schrieb William Ferguson: >> > > local function update_combobox_choices(combobox, choice_table, >> selected) >> > > >> > > local items = #combobox >> > > local choices = #choice_table >> > > for i, name in ipairs(choice_table) do >> > > >> > > combobox[i] = name >> > > >> > > end >> > > if choices < items then >> > > >> > > for j = items, choices + 1, -1 do >> > > >> > > combobox[j] = nil >> > > >> > > end >> > > >> > > end >> > > combobox.value = selected >> > > >> > > end >> > >> > >> ___ >> > darktable developer mailing list >> > to unsubscribe send a mail to darktable-dev+unsubscribe@list >> s.darktable.org >> >> >> >> ___ >> darktable developer mailing list >> to unsubscribe send a mail to darktable-dev+unsubscribe@list >> s.darktable.org >> >> ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Lua combobox bug?
Thank you Christian. I was going to write an example similar to yours but didn't have time at the moment. Bill On May 4, 2017 3:03 PM, "Christian Kanzian" wrote: > Am Donnerstag, 4. Mai 2017, 20:02:02 CEST schrieb Holger Klemm: > > Thanks for the function. I do not understand how I must use that :-( > > choice_table? > > AFAIK a combobox stores its entries like a lua table with indices. > Updating lua table entries can only be done be looping over the entries? > That > is what Bill suggest in his reply. > > Merging your test.lua with Bill's answer like that works for me: > > local dt = require "darktable" > > test_combobox = dt.new_widget("combobox") > { > label = 'test combobox', > tooltip ='', > value = 1, > editable=true, > "1","2","3","4","5", > reset_callback = function(self_reset) >self_reset.value = 1 > end > } > > > local function update_combobox_choices(combobox, choice_table, selected) > local items = #combobox > local choices = #choice_table > for i, name in ipairs(choice_table) do > combobox[i] = name > end > if choices < items then > for j = items, choices + 1, -1 do > combobox[j] = nil > end > end > combobox.value = selected > end > > local new_choices = {"XX","YY"} > > add_button = dt.new_widget("button") > { > label = 'change combobox', > clicked_callback = function (x) > update_combobox_choices(test_combobox,new_choices,2) > dt.print("combobox changed") > end > } > > > local import_widget = dt.new_widget("box") { > test_combobox, > add_button, > > } > > Christian > > > > > Am Mittwoch, 3. Mai 2017, 15:55:42 CEST schrieb William Ferguson: > > > local function update_combobox_choices(combobox, choice_table, > selected) > > > > > > local items = #combobox > > > local choices = #choice_table > > > for i, name in ipairs(choice_table) do > > > > > > combobox[i] = name > > > > > > end > > > if choices < items then > > > > > > for j = items, choices + 1, -1 do > > > > > > combobox[j] = nil > > > > > > end > > > > > > end > > > combobox.value = selected > > > > > > end > > > > > ___ > > darktable developer mailing list > > to unsubscribe send a mail to darktable-dev+unsubscribe@ > lists.darktable.org > > > > ___ > darktable developer mailing list > to unsubscribe send a mail to darktable-dev+unsubscribe@ > lists.darktable.org > > ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Lua combobox bug?
Am Donnerstag, 4. Mai 2017, 20:02:02 CEST schrieb Holger Klemm: > Thanks for the function. I do not understand how I must use that :-( > choice_table? AFAIK a combobox stores its entries like a lua table with indices. Updating lua table entries can only be done be looping over the entries? That is what Bill suggest in his reply. Merging your test.lua with Bill's answer like that works for me: local dt = require "darktable" test_combobox = dt.new_widget("combobox") { label = 'test combobox', tooltip ='', value = 1, editable=true, "1","2","3","4","5", reset_callback = function(self_reset) self_reset.value = 1 end } local function update_combobox_choices(combobox, choice_table, selected) local items = #combobox local choices = #choice_table for i, name in ipairs(choice_table) do combobox[i] = name end if choices < items then for j = items, choices + 1, -1 do combobox[j] = nil end end combobox.value = selected end local new_choices = {"XX","YY"} add_button = dt.new_widget("button") { label = 'change combobox', clicked_callback = function (x) update_combobox_choices(test_combobox,new_choices,2) dt.print("combobox changed") end } local import_widget = dt.new_widget("box") { test_combobox, add_button, } Christian > > Am Mittwoch, 3. Mai 2017, 15:55:42 CEST schrieb William Ferguson: > > local function update_combobox_choices(combobox, choice_table, selected) > > > > local items = #combobox > > local choices = #choice_table > > for i, name in ipairs(choice_table) do > > > > combobox[i] = name > > > > end > > if choices < items then > > > > for j = items, choices + 1, -1 do > > > > combobox[j] = nil > > > > end > > > > end > > combobox.value = selected > > > > end > > ___ > darktable developer mailing list > to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Lua combobox bug?
Thanks for the function. I do not understand how I must use that :-( choice_table? Am Mittwoch, 3. Mai 2017, 15:55:42 CEST schrieb William Ferguson: > local function update_combobox_choices(combobox, choice_table, selected) > local items = #combobox > local choices = #choice_table > for i, name in ipairs(choice_table) do > combobox[i] = name > end > if choices < items then > for j = items, choices + 1, -1 do > combobox[j] = nil > end > end > combobox.value = selected > end ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Problem with register_lib in lua API
Excellent, no more crashes. The lib from my script now plays nicely with the others too (that wasn't the case before: it didn't automatically close when I opened another one). Thanks for the quick solution! 2017-05-04 9:09 GMT+02:00 Tobias Ellinghaus : > Am Mittwoch, 3. Mai 2017, 18:16:49 CEST schrieb Jefferson Ferreira: > > Hi, > > > > I found the real problem. The problem occurs when I add the following > line > > in darktablerc: > > > > lighttable/ui/single_module=TRUE > > > > If I remove this line, my lua code works perfectly, and the darktable > does > > not break when I click on the export module. > > Should be fixed in master now. > > > []'s > > > > On Wed, May 3, 2017 at 3:46 AM, Tobias Ellinghaus wrote: > > > Am Dienstag, 2. Mai 2017, 16:37:20 CEST schrieb Jefferson Ferreira: > > > > Hi, > > > > > > > > This link has the content of gdb.txt with the output of gdb. My luarc > > > > has > > > > just the code that I mentioned at the first email. > > > > > > > > https://www.dropbox.com/s/pjydo45jrndu8o5/gdb.txt?dl=0 > > > > > > Thanks, that looks familiar. Initially I had that, too, but somehow > never > > > got > > > it again. It seems to be due to how lua handles its objects > internally. I > > > will > > > ask Jeremy for advice. > > > > > > For those curious, the relevant part is > > > > > > Thread 1 (Thread 0x77ee0ac0 (LWP 15239)): > > > #0 get_position_description (cur_view=0x2295300, gui_data=0x26c73d0) > at / > > > home/jeff/Tools/Darktable/darktable/src/lua/lualib.c:94 > > > > > > position_description = > > > iter = 0x1 > > > > > > #1 0x77ab7314 in container_wrapper (self=) at > > > /home/ > > > jeff/Tools/Darktable/darktable/src/lua/lualib.c:104 > > > > > > cur_view = > > > gui_data = 0x26c73d0 > > > position_description = > > > > > > #2 0x77a9d36b in _lib_plugin_header_button_press > (w= > > out>, > > > e=, user_data=0x26c4c00) at /home/jeff/Tools/Darktable/ > > > darktable/src/libs/lib.c:929 > > > > > > m = 0x2cb0b70 > > > it = 0x2067840 > > > v = 0x2295300 > > > all_other_closed = 1 > > > container = 4 > > > w = > > > user_data = 0x26c4c00 > > > e = > > > module = 0x26c4c00 > > > > > > where iter is suddenly "1" instead of a valid pointer. To me it looks > like > > > somewhere the struct holding the lib data is copied without taking into > > > account that there are pointers inside. > > > > > > > Thanks in advance. > > > > > > Tobias > > > > > > [...] > > ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Deconvolution and Python framework
I can only speak for myself but I find it very interesting. Am 04.05.2017 03:32 schrieb "Aurélien PIERRE" : > Hi, > > I got critics so I made it better ;-) My Richardson-Lucy implementation > now allows to set a mask. This mask is intended to specify the zone where > the focus is supposed to be, and thus compute the deconvolution matrix > estimation only there. This matrix is then used to deconvolute the whole > picture. I got faaar better results regarding the general > smudginess/sharpness ratio : https://github.com/ > aurelienpierre/Image-Cases-Studies/commit/bfaf6930abd873e568ee12f90427da > d0206d6de6 > > I don't know how much the community is interested in my experiments though > or if it's relevant here, so just tell me if I spam. > > Have a nice day, > > *Aurélien PIERRE* > aurelienpierre.com > -- > > Le 2017-05-03 à 04:42, Aurélien PIERRE a écrit : > > Hi, > > being a Darktable user since 2010 (0.9 if I recall), a photographer for > many years and an almost engineer, I have looked for a long time to get > involved into DT development. I know 10 programming languages but I'm still > a newbie in C… > > Following my last email on adaptative deconvolution, I started a Python > framework to experiment on image processing algorithms. The Github repos is > here : https://github.com/aurelienpierre/Image-Cases-Studies > > I already have 3 case studies, with algorithms and before/after pictures : > >- Unsharp masking with bilateral filter in LAB space >- Defringing with bilateral filter in LAB space >- Focus correction/restoration with Richardson-Lucy deconvolution in >RGB and LAB spaces. > > I'm trying to keep my code as clean as possible to make it easy to > understand and possible to translate into C and (hopefully) into Darktable > modules. The framework is packaged with a Python setup file and optimized > with Cython and parallel computing. > > I will continue to experiment on deconvolution but any comment, code > review, scientific article, or contribution is welcome. > Have a nice day, > -- > > *Aurélien PIERRE* > aurelienpierre.com > -- > > > ___ > darktable developer mailing list to unsubscribe send a mail to > darktable-dev+unsubscr...@lists.darktable.org > > > > ___ > darktable developer mailing list to unsubscribe send a mail to > darktable-dev+unsubscr...@lists.darktable.org > ___ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
Re: [darktable-dev] Problem with register_lib in lua API
Am Mittwoch, 3. Mai 2017, 18:16:49 CEST schrieb Jefferson Ferreira: > Hi, > > I found the real problem. The problem occurs when I add the following line > in darktablerc: > > lighttable/ui/single_module=TRUE > > If I remove this line, my lua code works perfectly, and the darktable does > not break when I click on the export module. Should be fixed in master now. > []'s > > On Wed, May 3, 2017 at 3:46 AM, Tobias Ellinghaus wrote: > > Am Dienstag, 2. Mai 2017, 16:37:20 CEST schrieb Jefferson Ferreira: > > > Hi, > > > > > > This link has the content of gdb.txt with the output of gdb. My luarc > > > has > > > just the code that I mentioned at the first email. > > > > > > https://www.dropbox.com/s/pjydo45jrndu8o5/gdb.txt?dl=0 > > > > Thanks, that looks familiar. Initially I had that, too, but somehow never > > got > > it again. It seems to be due to how lua handles its objects internally. I > > will > > ask Jeremy for advice. > > > > For those curious, the relevant part is > > > > Thread 1 (Thread 0x77ee0ac0 (LWP 15239)): > > #0 get_position_description (cur_view=0x2295300, gui_data=0x26c73d0) at / > > home/jeff/Tools/Darktable/darktable/src/lua/lualib.c:94 > > > > position_description = > > iter = 0x1 > > > > #1 0x77ab7314 in container_wrapper (self=) at > > /home/ > > jeff/Tools/Darktable/darktable/src/lua/lualib.c:104 > > > > cur_view = > > gui_data = 0x26c73d0 > > position_description = > > > > #2 0x77a9d36b in _lib_plugin_header_button_press (w= > out>, > > e=, user_data=0x26c4c00) at /home/jeff/Tools/Darktable/ > > darktable/src/libs/lib.c:929 > > > > m = 0x2cb0b70 > > it = 0x2067840 > > v = 0x2295300 > > all_other_closed = 1 > > container = 4 > > w = > > user_data = 0x26c4c00 > > e = > > module = 0x26c4c00 > > > > where iter is suddenly "1" instead of a valid pointer. To me it looks like > > somewhere the struct holding the lib data is copied without taking into > > account that there are pointers inside. > > > > > Thanks in advance. > > > > Tobias > > > > [...] signature.asc Description: This is a digitally signed message part.