Ghini / ghini.desktop

plant collections manager (desktop version)
http://ghini.github.io/
GNU General Public License v2.0
24 stars 14 forks source link

add a GUI for entering geographic information #330

Closed mfrasca closed 6 years ago

mfrasca commented 6 years ago

Actual behaviour

currently, you need to enter coordinates and distances numerically, for example when I enter the coordinates of placement of a plant, I have to first do this on a map, extract the coordinates (possibly in a spreadsheet), import it in ghini.desktop.

Expected behaviour

I want to specify the position on a map. something like, when entering plant data, having a button that opens a map, centred on the garden, and lets me specify the precise position by clicking on the correct spot.

Opinions and suggestions

(gtk/Linux) https://wiki.openstreetmap.org/wiki/Frameworks#Displaying_interactive_maps *(gtk/) http://nzjrs.github.io/osm-gps-map/** (kde/Linux) https://wiki.openstreetmap.org/wiki/KDE_Marble

let's see if others have other options, on stackoverflow. at the time of writing, the only answer only gave web-based solutions.

mfrasca commented 6 years ago

an other option, and the code looks quite neat, is to use LibChamplain, but it requires Gtk 3.0, and that is incompatible with PyGTK. the first big difficulty I experience in migrating ghini from PyGTK to Gtk3 is in the ComboBoxEntry, which disappeared in Gtk3.
Start by running this script, then see for yourself. https://raw.githubusercontent.com/GNOME/pygobject/master/tools/pygi-convert.sh http://dumbmatter.com/2012/02/some-notes-on-porting-from-pygtk-to-pygobject/

mfrasca commented 6 years ago

I've started parking work in a broken branch, called gtk2→3 and I'm adding a 'print' next to each line I'm commenting, just for the sake of letting the code run.

AttributeError: 'CellView' object has no attribute 'get_completion'
mfrasca commented 6 years ago

a couple of links, thanks to @Aran-Fey and @phastmike, via stackoverflow: https://gitlab.gnome.org/GNOME/pygobject/raw/master/tools/pygi-convert.sh https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Container.html https://developer.gnome.org/pygtk/stable/class-gtkobject.html guys, if you want to get involved here, please! :bowing_man:

mfrasca commented 6 years ago
mfrasca commented 6 years ago

I guess this error is blocking it the infoboxes AttributeError: 'module' object has no attribute 'BuilderLoader'

  File "/home/mario/.virtualenvs/ghide-gtk2-3/local/lib/python2.7/site-packages/ghini.desktop-\
1.0.83-py2.7.egg/bauble/view.py", line 741, in on_cursor_changed
    self.update_bottom_notebook()
  File "/home/mario/.virtualenvs/ghide-gtk2-3/local/lib/python2.7/site-packages/ghini.desktop-\
1.0.83-py2.7.egg/bauble/view.py", line 631, in update_bottom_notebook
    self.add_page_to_bottom_notebook(bottom_info)
  File "/home/mario/.virtualenvs/ghide-gtk2-3/local/lib/python2.7/site-packages/ghini.desktop-\
1.0.83-py2.7.egg/bauble/view.py", line 593, in add_page_to_bottom_notebook
    builder = utils.BuilderLoader.load(glade_name)
AttributeError: 'module' object has no attribute 'BuilderLoader'
  File "/home/mario/.virtualenvs/ghide-gtk2-3/local/lib/python2.7/site-packages/ghini.desktop-\
1.0.83-py2.7.egg/bauble/view.py", line 742, in on_cursor_changed
    pictures_view.floating_window.set_selection(self.get_selected_values())
  File "/home/mario/.virtualenvs/ghide-gtk2-3/local/lib/python2.7/site-packages/ghini.desktop-\
1.0.83-py2.7.egg/bauble/pictures_view.py", line 68, in set_selection
    self.box = self.widgets.pictures_box
RuntimeError: field is not writable
phastmike commented 6 years ago

@mfrasca Gtk.ComboBox with Entry still exists, it is integrated within Gtk.ComboBox itself, check https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/ComboBox.html#Gtk.ComboBox.new_with_entry

mfrasca commented 6 years ago

@phastmike, the interface here is all in glade files, I don't think I can use that static function. … I'm more looking in the direction of the new glade equivalent to ComboBoxEntry, I think I wrote a small test case, let me look for it.

mfrasca commented 6 years ago

Looks like I had found something to work upon, but I've not yet processed it in the software: https://stackoverflow.com/questions/49941134/what-is-the-glade-equivalent-of-combobox-new-with-model-and-entry It doesn't yet cover the case in the software, where the pull down list needs to show more information than I want to accept in the Entry. The pull down list shows »Genus-epithet (Family-epithet)«, the entry only contains »Genus-epithet«.

mfrasca commented 6 years ago

GLib.Error: gtk-builder-error-quark: Unknown internal child: entry (6) is the error we get when I replace ComboBoxEntry with ComboBox and I don't put this block in it:

            <property name="has_entry">True</property>
            <child internal-child="entry">
              <object class="GtkEntry">
                <property name="can_focus">True</property>
              </object>
            </child>

then we have a combobox with an entry, if: isinstance(widget, Gtk.ComboBox) and isinstance(widget.get_child(), Gtk.Entry)

mfrasca commented 6 years ago

indeed there were more properties for which I need to use getter.

now this … GtkComboBox.text_column

mfrasca commented 6 years ago

moving to Gtk3 somehow makes reports from nosetests more readable: Exception sqlalchemy.exc.OperationalError: OperationalError('(sqlite3.OperationalError) no such table: history',) in <bound method PlantEditor.__del__ of <bauble.plugins.garden.plant.PlantEditor object at 0x7f0070385090>> ignored AttributeError: FakeGui instance has no attribute 'window' AttributeError: FakeGui instance has no attribute 'add_to_insert_menu'

mfrasca commented 6 years ago

good enough for starting to play with what is the title of this issue. screenshot from 2018-05-22 08-08-38 and also good enough to start doing what @comradekingu was suggesting

mfrasca commented 6 years ago

screenshot from 2018-05-22 08-08-23

mfrasca commented 6 years ago

you can type manually, or edit by opening the interactive map. if a value is already present, the circle and the two markers are added to the map, and the interactive map starts at the correct location and zoom.