Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-22 Thread David Cousens
Forgot Link to Bug report and patch file
https://bugs.gnucash.org/show_bug.cgi?id=796778

David



-
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-22 Thread David Cousens
Hi,

I have attached a patch file with changes to
gnucash/import-export/import-main-matcher.c and 
gnucash/gtkbuilder/dialog-import.glade for adding multiple selection
capability to the import-matcher with the ability to assign a single
transfer
 account to the selected transactions. 

Transactions can be selected by any combination of Ctrl-click , Shift -click
and click and mouse drag. Using either a Right click on the importer or the
Shift-F10 GTK Popup menu shortcut will bring up a popupmenu with a single
entry "Assign a transfer account". Clicking on that initiates selecting a
transfer account and then assigning it to all transactions in the selection. 

Control is the returned to the import matcherwhere another group of
transactions can be selected and the process repaeted until all transactions
have a transfer account applied. Clicking OK will then import the
transactions as usual. 

The orignial double-click to input a transfer account for a single
transaction is unaffectedby the above changes.  I have tested the above
changes with "File->Import->Import OFX/QFX". and they work fine.  They
should also apply to any of the transaction import formats as they were
changes only to the import-main-matcher which seems to be common to the
other formats

I was looking for an appropriate point to modify the documentation, but I
could not find a section on the importing of transactions from files in
either the Tutorial and Concepts Guide or the Help Manual. Chapter 6 of the
Help Manual on Common Transaction operations would seem to me to be a
logical point to document importing transactions from OFX/QFX or CSV files,
for example either before or after 6.15 Online Actions. 
e.g. 
6.16 Importing Transactions from Files followed by 
6.17  General Journal.

Unless the documentation team has another suggestion or already has work in
progress on this, I am willing to have a go at producing some documentation
of the importing of transactions from files.

David Cousens



-
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-13 Thread Geert Janssens



David Cousens  schreef op 12 augustus 2018 23:53:09 
CEST:

> The barrier up to now has always been
>finding my way round the code base but I found a program called
>SourceTrail which is great for locating all the places a particular
>variable structure or function is used. making tracking down
>dependencies in the code a lot easier.
>

That is a feature of many modern IDE's. I am currently using KDevelop which has 
something similar. And before I have long used eclipse which also has it. I 
agree it helps a lot in navigating around in tge gnucash code base.

Geert
Sent from my smartphone. Please excuse my brevity.
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread David Cousens
Rob,
I think it was I who was missing something. I would have expected the
Ctrl-click behaviour to be built in to the GTkTreeView and the dGTK
developers obviously thought it was so obvious they didn't have to mention
it. The pointers John gave me should help me sort it out.

Thanks

David



-
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread David Cousens
Thanks John,That cleared a few issues up for me. I'll have a look at
the gnc- tree- view-account  code to get some pointers. I have
programmed before in C ,only a very little in C++, but I am fairly
rusty . I was surprised to get a few things wokring without any
problems so far. I am not sure bravery is the right word - possibly
more like senile dementia. The barrier up to now has always been
finding my way round the code base but I found a program called
SourceTrail which is great for locating all the places a particular
variable structure or function is used. making tracking down
dependencies in the code a lot easier.
CheersDavid
> 
> David,
> Your bravery is admirable, but it takes a lot of study to
> successfully customize Gtk internals and GtkTreeView is one of Gtk’s
> most complex features. Fortunately GtkTreeView already has ctrl-click 
> multiple selection and GnuCash has GtkTreeViews using it, for example
> the account selection in report options. The code for that is in http
> s://github.com/Gnucash/gnucash/blob/maint/gnucash/gnome-utils/gnc-
> tree-view-account.c.
> Regards,John Ralls
> 
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread John Ralls


> On Aug 12, 2018, at 12:22 AM, David Cousens  wrote:
> 
> Hi,
> 
> I raised the above bug as a feature request then I decided to try and tackle
> it myself. My concept was to have a popup menu activated by a right click in
> the matcher window area from which the user could enable and disable
> multiple selection of transactions in the window and elect to assign a
> transfer account to a selection of multiple rows. My reason for doing this
> is I often have within an imported set of transactions, sets of multiple
> transactions which have the same transfer account and processing an import
> would be speeded up if these could be selected as a group and the the
> transfer account selected and applied to the group. 
> 
> I now have a lot of the basic code in place to process a selection and to
> create and view a popup menu, activate and disable multiple selection and
> process a group of selected rows, partially tested but I have struck a
> problem in that the GtkTreeView does not implement Ctrl-click selection in
> the API and i am going to have to provide that myself.
> 
> As far as I can see from the code in import-main-matcher.c GnuCash does not
> seem to implement anything other than a mouse double click to select a
> single row which is processed by the callback initiated by the TreeView
> "row-activated" event. I.e. there is no selection by pressing "Enter" while
> the focus is on a given row. 
> 
> My plan is to detect Ctrl-Left click (implemented) and use that to add rows
> to the selection and then initiate the processing of the selection using the
> right click (implemented) popup menu. To do this, I have to detect a
> GDK_BUTTON_PRESS event and then use the event->state to determine whether
> Ctrl is pressed simultaneously (implemented) or whether the third mouse
> button has been clicked (implemented) . This however appears to short
> circuit the "row-activated" event detection by the GtkTreeView as it detects
> the sequence:
> GDK_BUTTON_PRESS
> GDK_BUTTON_RELEASE
> GDK_BUTTON_PRESS
> GDK_BUTTON_RELEASE if it occurs within 0.25 s
> so I am going to have to provide my own double click detection within the
> callback I use to process the initial button press.
> 
> My question is is this. Is what I have outlined above likely to interfere
> with any non mouse based selection of transactions for applying a transfer
> account and does the approach seem reasonable? I can't see that occurring in
> the code for the main matcher, but I am a relative novice in using Gdk and
> Gtk so I could be easily missing something. E.g. Up, Down keys to shift the
> row focus and Enter to select for example. 
> 

David,

Your bravery is admirable, but it takes a lot of study to successfully 
customize Gtk internals and GtkTreeView is one of Gtk’s most complex features. 
Fortunately GtkTreeView already has ctrl-click multiple selection and GnuCash 
has GtkTreeViews using it, for example the account selection in report options. 
The code for that is in 
https://github.com/Gnucash/gnucash/blob/maint/gnucash/gnome-utils/gnc-tree-view-account.c
 
.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread John Ralls


> On Aug 12, 2018, at 3:47 AM, David Cousens  wrote:
> 
>  I am assuming here that the python GTK
> implementation is an exact parallel of the C++ implementation. I would
> expect it to be pretty similar and possibly just the C++ code in Python
> wrappers.

David,

Gtk+ is written in C, not C++, and includes comment-based introspection. A 
separate project, gobject-introspection, generates an introspection library 
from the comments, and a third project, pygobject, converts the introspection 
library into python. The resulting python API exactly reflects the C one.

There is a separate project, gtkmm, that wraps Gtk+ in C++. It does not use 
gobject-introspection.

When using python documentation be sure that it’s not for PyGtk, an older 
non-gobject-introspection wrapper for Gtk+-2.0. That API didn’t exactly reflect 
the underlying one, and besides Gtk2 differs somewhat from Gtk3.

Regards,
John Ralls
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread Robert Fewell
David,
I may be missing some thing but you should be able to select lines by
control, shift or by individual.
I think what you are after can be shown in the reconcile view, multiple
lines can be selected and then right moused to a menu.

Anyway, enjoy your holiday...

Bob

On 12 August 2018 at 11:47, David Cousens  wrote:

> Bob,
>
> From what I've read in the GtkTreeView documentation, the rubber-banding
> mode only seems to support selection by dragging the mouse so one is only
> able to select consecutive rows, not a group of single non-contiguous rows.
> I could of course be wrong on that.  It obviously sets the
> GTK_SELECTION_MULTIPLE mode of a GtkTreeSelection along with the drag
> detection. I find the Gtk documentation extremely terse and unhelpful in
> some areas. I did find a reference to the row-activated signal being
> emitted
> when"when a non-editable row is selected and one of the keys: Space,
> Shift+Space, Return or Enter is pressed." which would permit non-mouse row
> activation to initiate the selection of a transfer account
>
> I also found a Python gtk discussion to the effect that GtkTreeView's
> slection capabilities were limited pretty well to the drag over to select
> and from that found a hint on how to do Ctrl click event detection using
> the
> GdkEventButton using the event-> state and also how to detect the right
> click event.  When I included that in the import-main-matcher.c the
> row-activated signal stopped working. I am assuming here that the python
> GTK
> implementation is an exact parallel of the C++ implementation. I would
> expect it to be pretty similar and possibly just the C++ code in Python
> wrappers.
>
> I may have to setup a dummy program implementing  a TreeView and just play
> with how things work with rubber banding and multiple selection until I
> understand it better and the interaction between the rubber-banding and
> multiple selection mode. Usually the best way of understanding incomplete
> or
> unclear documentation.
>
> I'm away for a few days on holidays so I'll try and tackle it then if my
> wife lets me get an opportunity. Otherwise it will be when I return.
>
> Cheers
>
> David
>
>
>
> -
> David Cousens
> --
> Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
> ___
> gnucash-devel mailing list
> gnucash-devel@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread David Cousens
Bob,

>From what I've read in the GtkTreeView documentation, the rubber-banding
mode only seems to support selection by dragging the mouse so one is only
able to select consecutive rows, not a group of single non-contiguous rows.
I could of course be wrong on that.  It obviously sets the
GTK_SELECTION_MULTIPLE mode of a GtkTreeSelection along with the drag
detection. I find the Gtk documentation extremely terse and unhelpful in
some areas. I did find a reference to the row-activated signal being emitted
when"when a non-editable row is selected and one of the keys: Space,
Shift+Space, Return or Enter is pressed." which would permit non-mouse row
activation to initiate the selection of a transfer account

I also found a Python gtk discussion to the effect that GtkTreeView's
slection capabilities were limited pretty well to the drag over to select
and from that found a hint on how to do Ctrl click event detection using the
GdkEventButton using the event-> state and also how to detect the right
click event.  When I included that in the import-main-matcher.c the
row-activated signal stopped working. I am assuming here that the python GTK
implementation is an exact parallel of the C++ implementation. I would
expect it to be pretty similar and possibly just the C++ code in Python
wrappers.

I may have to setup a dummy program implementing  a TreeView and just play
with how things work with rubber banding and multiple selection until I
understand it better and the interaction between the rubber-banding and
multiple selection mode. Usually the best way of understanding incomplete or
unclear documentation.

I'm away for a few days on holidays so I'll try and tackle it then if my
wife lets me get an opportunity. Otherwise it will be when I return.

Cheers

David



-
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] Bug 796778 Feature Request Multiple Selection in Import- matcher

2018-08-12 Thread Robert Fewell
David,
Why do you not as a start change the tree view selection from single to
multiple, you will see that in the dialog-import.glade file, that way you
can select multiple lines.
You will need to alter the selection call back as you need different
functions that use a list of selected rows.

Bob

On 12 August 2018 at 08:22, David Cousens  wrote:

> Hi,
>
> I raised the above bug as a feature request then I decided to try and
> tackle
> it myself. My concept was to have a popup menu activated by a right click
> in
> the matcher window area from which the user could enable and disable
> multiple selection of transactions in the window and elect to assign a
> transfer account to a selection of multiple rows. My reason for doing this
> is I often have within an imported set of transactions, sets of multiple
> transactions which have the same transfer account and processing an import
> would be speeded up if these could be selected as a group and the the
> transfer account selected and applied to the group.
>
> I now have a lot of the basic code in place to process a selection and to
> create and view a popup menu, activate and disable multiple selection and
> process a group of selected rows, partially tested but I have struck a
> problem in that the GtkTreeView does not implement Ctrl-click selection in
> the API and i am going to have to provide that myself.
>
> As far as I can see from the code in import-main-matcher.c GnuCash does not
> seem to implement anything other than a mouse double click to select a
> single row which is processed by the callback initiated by the TreeView
> "row-activated" event. I.e. there is no selection by pressing "Enter" while
> the focus is on a given row.
>
> My plan is to detect Ctrl-Left click (implemented) and use that to add rows
> to the selection and then initiate the processing of the selection using
> the
> right click (implemented) popup menu. To do this, I have to detect a
> GDK_BUTTON_PRESS event and then use the event->state to determine whether
> Ctrl is pressed simultaneously (implemented) or whether the third mouse
> button has been clicked (implemented) . This however appears to short
> circuit the "row-activated" event detection by the GtkTreeView as it
> detects
> the sequence:
> GDK_BUTTON_PRESS
> GDK_BUTTON_RELEASE
> GDK_BUTTON_PRESS
> GDK_BUTTON_RELEASE if it occurs within 0.25 s
> so I am going to have to provide my own double click detection within the
> callback I use to process the initial button press.
>
> My question is is this. Is what I have outlined above likely to interfere
> with any non mouse based selection of transactions for applying a transfer
> account and does the approach seem reasonable? I can't see that occurring
> in
> the code for the main matcher, but I am a relative novice in using Gdk and
> Gtk so I could be easily missing something. E.g. Up, Down keys to shift the
> row focus and Enter to select for example.
>
> David Cousens.
>
>
>
> -
> David Cousens
> --
> Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
> ___
> gnucash-devel mailing list
> gnucash-devel@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel