Re: [darktable-dev] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Patrick Shanahan
* Mario Lüder  [04-16-18 18:43]:
> Hi Dan,
> 
> Thanks for your advise. I thought that mailing list here would the right
> channel to communicate thoughts/ideas and getting suggestion in return.
> 
> I have pushed my changes and did a pull request.
> 
> I hope nobody feels offended by doing it in this way. I am open for
> comments and suggestions. So please let me know what to enhance.
> 
> Best regards,
> Mario
> 
> 
> 
> 2018-04-16 21:50 GMT+02:00 Dan Torop :
> 
> > Hi Mario,
> >
> > Thank you! You should also, certainly, chat with the darktable developers
> > (IRC?) before going too far. They've been clear in the past that they don't
> > want someone putting in lots of work on a feature if they don't think it'll
> > make it in, or make it in in the initial form. I'd be curious as to their
> > thoughts on how custom image sorting could work...
> >
> > Dan




Dan's advice to visit with the dev's on irc, #darktable, is "the right
thing".  they are readily accessible and amenable to suggestions and
requests.  and can tell you whether your changes will be considered,
before you invest a great deal of time and energy.  and perhaps stop you
from coming away with a "bad taste".

they are usually available in line with Germany time table.


-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
Registered Linux User #207535@ http://linuxcounter.net
Photos: http://wahoo.no-ip.org/piwigo   paka @ IRCnet freenode
___
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org



Re: [darktable-dev] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Mario Lüder
Hi Dan,

Thanks for your advise. I thought that mailing list here would the right
channel to communicate thoughts/ideas and getting suggestion in return.

I have pushed my changes and did a pull request.

I hope nobody feels offended by doing it in this way. I am open for
comments and suggestions. So please let me know what to enhance.

Best regards,
Mario



2018-04-16 21:50 GMT+02:00 Dan Torop :

> Hi Mario,
>
> Thank you! You should also, certainly, chat with the darktable developers
> (IRC?) before going too far. They've been clear in the past that they don't
> want someone putting in lots of work on a feature if they don't think it'll
> make it in, or make it in in the initial form. I'd be curious as to their
> thoughts on how custom image sorting could work...
>
> Dan
>
>
>
> On Mon, Apr 16, 2018, at 3:47 PM, Mario Lüder wrote:
>
> Hi Dan,
>
> thanks for your suggestion and your interest.
>
> To your suggestion
>
> Perhaps a simpler version is best: sort order associated not with a
> particular "collect images" filter but as another column in the "images"
> table. This would cause less worry about a lengthy join and indexing on a
> TEXT column in "custom_image_order". And once "places|beach" is given a
> custom sequence, it will maintain that even if the collection is further
> filtered. And somewhat maintain that sequence for other collections which
> overlap it. This would also not leave "ghost" custom image orders laying
> order when a tag or film roll is deleted. On the other hand, it wouldn't
> allow for creating tags "sequence|v1" and then "sequence|v2" with utterly
> different orders.
>
>
> I like your idea to simplify it. So I will implement it that way. First a
> version without the tags.
>
> Worth updating https://redmine.darktable.org/issues/9641 with a note of
> your progress/interest, to add to the record. Easier to search redmine than
> the mailing list.
>
>
> I'll check that.
>
> Thanks again and best regards,
> Mario
>
>
>
>
>
>
> ___
> 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] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Dan Torop
Hi Mario,

Thank you! You should also, certainly, chat with the darktable
developers (IRC?) before going too far. They've been clear in the
past that they don't want someone putting in lots of work on a
feature if they don't think it'll make it in, or make it in in the
initial form. I'd be curious as to their thoughts on how custom image
sorting could work...
Dan



On Mon, Apr 16, 2018, at 3:47 PM, Mario Lüder wrote:
> Hi Dan, 
> 
> thanks for your suggestion and your interest. 
> 
> To your suggestion
>> Perhaps a simpler version is best: sort order associated not with a
>> particular "collect images" filter but as another column in the
>> "images" table. This would cause less worry about a lengthy join and
>> indexing on a TEXT column in "custom_image_order". And once
>> "places|beach" is given a custom sequence, it will maintain that even
>> if the collection is further filtered. And somewhat maintain that
>> sequence for other collections which overlap it. This would also not
>> leave "ghost" custom image orders laying order when a tag or film
>> roll is deleted. On the other hand, it wouldn't allow for creating
>> tags "sequence|v1" and then "sequence|v2" with utterly different
>> orders.>  
> I like your idea to simplify it. So I will implement it that way.
> First a version without the tags.>
>> Worth updating https://redmine.darktable.org/issues/9641 with a note
>> of your progress/interest, to add to the record. Easier to search
>> redmine than the mailing list.> 
> I'll check that.
> 
> Thanks again and best regards,
> Mario
> 
> 
> 
> 
> 
> 
> _-
> __ 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] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Mario Lüder
Hi Dan,

thanks for your suggestion and your interest.

To your suggestion

> Perhaps a simpler version is best: sort order associated not with a
> particular "collect images" filter but as another column in the "images"
> table. This would cause less worry about a lengthy join and indexing on a
> TEXT column in "custom_image_order". And once "places|beach" is given a
> custom sequence, it will maintain that even if the collection is further
> filtered. And somewhat maintain that sequence for other collections which
> overlap it. This would also not leave "ghost" custom image orders laying
> order when a tag or film roll is deleted. On the other hand, it wouldn't
> allow for creating tags "sequence|v1" and then "sequence|v2" with utterly
> different orders.


I like your idea to simplify it. So I will implement it that way. First a
version without the tags.

Worth updating https://redmine.darktable.org/issues/9641 with a note of
> your progress/interest, to add to the record. Easier to search redmine than
> the mailing list.


I'll check that.

Thanks again and best regards,
Mario

___
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Re: [darktable-dev] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Mario Lüder
Hi Jefferson, hi Heiko,

Jefferson, thanks for pointing that out. I have fixed that issue.

Heiko, I have done a pull request for my change. See:
https://github.com/darktable-org/darktable/pull/1677

So, I am (eagerly :-) ) wait for for your response - It would be helpful
for me to get your feedback soon as I am now a bit familiar with darktable
code.

Best regards,
Mario

2018-04-16 16:16 GMT+02:00 Jefferson Ferreira :

> Hello,
>
> I tested your patch and works well. But, I am having problems to use the
> module "White Balance" with option "Spot" activated. The darktable think
> that I am trying to mode the image.
>
> Best regards.
>

2018-04-16 9:55 GMT+02:00 Heiko Bauke :

> Hi,
>
> Am 15.04.2018 um 22:16 schrieb Mario Lüder:
>
>> Thanks for your interest. You may find my patch attached.
>>
>
> looks interesting and potentially useful.
>
> I think the canonical way to contribute code to draktabe is to open a pull
> request on github, see https://github.com/darktable-org/darktable/
> To get something into darktable, it is not sufficient to implement a
> useful feature.  Darktable core developers also consider code quality.
> Be patient if your pull request is not merged immediately into darktable.
> After you have opened a pull request wait for feedback and try to respond
> in a constructive manner to comments and criticism.
>
>
> Heiko
>
>
> --
> -- Number Crunch Blog @ https://www.numbercrunch.de
> --  Cluster Computing @ https://www.clustercomputing.de
> --   Professional @ https://www.mpi-hd.mpg.de/personalhomes/bauke
> --  Social Networking @ https://www.researchgate.net/profile/Heiko_Bauke
> 
> ___
> 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] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Dan Torop
Hi Mario,

The patch looks sympathetic with the spirit of the darktable code, and you've 
clearly gotten deep into the code. A query, from reading it through (I haven't 
run it), is about sort order depending upon the setting of "collect images" as 
a string:

- What if the user filters the images by tags "places|beach" and 
"darktable|printed|%", and hand-sorts that collection. Then some other day the 
user reverses this filter (by "darktable|printed|%" and "places|beach"). The 
same images will display, but the sort order is lost.

- Similarly, what if the user filters the images by "places|beach" and makes a 
good sequence. Then they sub-filter by narrowing down to "darktable|printed|%". 
The sort order is now lost.

I wonder what the ideal behavior is here. Should each tag, film roll, etc. have 
its own potential custom sort order, and should successive filtering via 
"collect images" have no result on that order, hence only the first chosen 
filter (or the first chosen filter with a custom order) matter?

Perhaps a simpler version is best: sort order associated not with a particular 
"collect images" filter but as another column in the "images" table. This would 
cause less worry about a lengthy join and indexing on a TEXT column in 
"custom_image_order". And once "places|beach" is given a custom sequence, it 
will maintain that even if the collection is further filtered. And somewhat 
maintain that sequence for other collections which overlap it. This would also 
not leave "ghost" custom image orders laying order when a tag or film roll is 
deleted. On the other hand, it wouldn't allow for creating tags "sequence|v1" 
and then "sequence|v2" with utterly different orders.

To add to what Heiko wrote about contributing code:

- Worth updating https://redmine.darktable.org/issues/9641 with a note of your 
progress/interest, to add to the record. Easier to search redmine than the 
mailing list.

- It's highly recommended to visit irc.freenode.net, channel #darktable to 
check in with developers. A great way for them to get a sense of what you're up 
to, and for you to get a sense of their interests/concerns.

And to echo, making a PR is a great way to put your code on-the-record and 
allow a forum there for discussion/improvement.

I'm another who came to darktable hoping to find a way to reorder images. My 
work-around finally ended up being using the print module to make 4x6 work 
prints, and to arrange those images on a table. This works quite well, though 
of course requires more resources. I'd be thrilled if your work turns into a 
good way to resequence images in lighttable.

Regards,
Dan



On Mon, Apr 16, 2018, at 3:55 AM, Heiko Bauke wrote:
> Hi,
> 
> Am 15.04.2018 um 22:16 schrieb Mario Lüder:
> > Thanks for your interest. You may find my patch attached.
> 
> looks interesting and potentially useful.
> 
> I think the canonical way to contribute code to draktabe is to open a 
> pull request on github, see https://github.com/darktable-org/darktable/
> To get something into darktable, it is not sufficient to implement a 
> useful feature.  Darktable core developers also consider code quality.
> Be patient if your pull request is not merged immediately into 
> darktable.  After you have opened a pull request wait for feedback and 
> try to respond in a constructive manner to comments and criticism.
> 
> 
>   Heiko
> 
> 
> -- 
> -- Number Crunch Blog @ https://www.numbercrunch.de
> --  Cluster Computing @ https://www.clustercomputing.de
> --   Professional @ https://www.mpi-hd.mpg.de/personalhomes/bauke
> --  Social Networking @ https://www.researchgate.net/profile/Heiko_Bauke
> ___
> 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] Re: Custom Image Order by Drag and Drop

2018-04-16 Thread Heiko Bauke

Hi,

Am 15.04.2018 um 22:16 schrieb Mario Lüder:

Thanks for your interest. You may find my patch attached.


looks interesting and potentially useful.

I think the canonical way to contribute code to draktabe is to open a 
pull request on github, see https://github.com/darktable-org/darktable/
To get something into darktable, it is not sufficient to implement a 
useful feature.  Darktable core developers also consider code quality.
Be patient if your pull request is not merged immediately into 
darktable.  After you have opened a pull request wait for feedback and 
try to respond in a constructive manner to comments and criticism.



Heiko


--
-- Number Crunch Blog @ https://www.numbercrunch.de
--  Cluster Computing @ https://www.clustercomputing.de
--   Professional @ https://www.mpi-hd.mpg.de/personalhomes/bauke
--  Social Networking @ https://www.researchgate.net/profile/Heiko_Bauke
___
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org



[darktable-dev] Re: Custom Image Order by Drag and Drop

2018-04-15 Thread Mario Lüder
Hi Jefferson,

Thanks for your interest. You may find my patch attached.

If you have any questions, please let me know.

Best regards,
Mario

2018-04-15 20:46 GMT+02:00 Mario Lüder :

> Hi,
>
> I missed the possibility to order images by drag and drop in lighttable. I
> needed this for my image selection process. I have to see the image in the
> right order to decide which one shall be kept and to see the sequence is
> "working".
>
> I have seen on several forums and the bug tracker that others are also
> keen to see this freature.
>
> So I took the time and implemented a simple version of it.
>
> Please see the short screencast on youtube
> https://youtu.be/Z2dwCXXzxbU
>
> The custom sequence is stored for each collection. So you can select an
> other collection and come back later to continue your work.
>
> I would like to post my changes for review. May I submit it to an
> development branch?
>
> Best,
> Mario
>

___
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

From d129ade50deb51c93159aef53b5298682db04adc Mon Sep 17 00:00:00 2001
From: Mario Lueder 
Date: Sun, 15 Apr 2018 20:20:43 +0200
Subject: [PATCH] Added custom image order by drag and drop in lighttable

---
 src/common/collection.c | 246 +++-
 src/common/collection.h |   6 +-
 src/common/database.c   |  20 +++-
 src/gui/gtk.c   |   4 +-
 src/libs/tools/filter.c |   1 +
 src/views/lighttable.c  |  91 +-
 6 files changed, 360 insertions(+), 8 deletions(-)

diff --git a/src/common/collection.c b/src/common/collection.c
index 8fb39e9..4dff27d 100644
--- a/src/common/collection.c
+++ b/src/common/collection.c
@@ -63,6 +63,32 @@ static void _dt_collection_recount_callback_2(gpointer instance, uint8_t id, gpo
 /* determine image offset of specified imgid for the given collection */
 static int dt_collection_image_offset_with_collection(const dt_collection_t *collection, int imgid);
 
+/* insert images from filtered collection into a respected custom sorted collection */
+static void dt_collection_insert_custom_order_images(const dt_collection_t *collection);
+
+gchar * dt_collection_get_current_id()
+{
+  char confname[200];
+  gchar * const separator = g_strdup(":");
+  gchar * collection_id = g_strdup("");
+
+  const int num_rules = dt_conf_get_int("plugins/lighttable/collect/num_rules");
+
+  for (int i = 0; i < num_rules; ++i)
+  {
+snprintf(confname, sizeof(confname), "plugins/lighttable/collect/string%1d", i);
+gchar * const ruleName = dt_conf_get_string(confname);
+gchar * new_collection_id = g_strconcat(collection_id, separator, ruleName, NULL);
+g_free(ruleName);
+g_free(collection_id);
+collection_id = new_collection_id;
+  }
+
+  g_free(separator);
+
+  return collection_id;
+}
+
 const dt_collection_t *dt_collection_new(const dt_collection_t *clone)
 {
   dt_collection_t *collection = g_malloc0(sizeof(dt_collection_t));
@@ -185,6 +211,14 @@ int dt_collection_update(const dt_collection_t *collection)
wq);
   else if(collection->params.query_flags & COLLECTION_QUERY_USE_ONLY_WHERE_EXT)
 selq = dt_util_dstrcat(selq, "SELECT DISTINCT images.id FROM main.images %s", wq);
+  else if(collection->params.sort == DT_COLLECTION_SORT_CUSTOM_ORDER
+  && (collection->params.query_flags & COLLECTION_QUERY_USE_SORT))
+  {
+gchar * const collection_id = dt_collection_get_current_id();
+selq = dt_util_dstrcat(selq, "SELECT DISTINCT id FROM (SELECT * FROM main.images WHERE %s) LEFT JOIN custom_image_order ON (id = img_id AND collection_id = '%s')",
+   wq, collection_id);
+g_free(collection_id);
+  }
   else
 selq = dt_util_dstrcat(selq, "SELECT DISTINCT id FROM main.images WHERE %s", wq);
 
@@ -390,6 +424,10 @@ gchar *dt_collection_get_sort_query(const dt_collection_t *collection)
 sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "folder DESC, filename DESC, version");
 break;
 
+  case DT_COLLECTION_SORT_CUSTOM_ORDER:
+sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "position DESC, filename DESC, version");
+break;
+
   case DT_COLLECTION_SORT_NONE:
 // shouldn't happen
 break;
@@ -427,6 +465,10 @@ gchar *dt_collection_get_sort_query(const dt_collection_t *collection)
 sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "folder, filename, version");
 break;
 
+  case DT_COLLECTION_SORT_CUSTOM_ORDER:
+sq = dt_util_dstrcat(sq, ORDER_BY_QUERY, "position, filename, version");
+break;
+
   case DT_COLLECTION_SORT_NONE:
 // shouldn't happen
 break;
@@ -516,7 +558,6 @@ GList *dt_collection_get(const dt_collection_t *collection, int limit, gboolean
   if((collection->params.query_flags & COLLECTION_QUERY_USE_SORT))
 sq =