Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working #11

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .pybuild/cpython3_3.12/.pydistutils.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[clean]
all=1
[build]
build_lib=/home/winship/dev/github/gourmand/.pybuild/cpython3_3.12/build
[install]
force=1
install_layout=deb
install_scripts=$base/bin
install_lib=/usr/lib/python3.12/dist-packages
prefix=/usr
633 changes: 633 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/Undo.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from gi import require_version

require_version("Gdk", "3.0")
require_version("Gst", "1.0")
require_version("Gtk", "3.0")
require_version("Pango", "1.0")
3 changes: 3 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if __name__ == '__main__':
from gourmand.main import launch_app
launch_app()
27 changes: 27 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from gourmand.i18n import _

appname = _("Gourmand Recipe Manager")
copyright = _("Copyright (c) 2004-2021 Thomas M. Hinkle and Contributors.\n"
"Copyright (c) 2021 The Gourmand Team and Contributors")
version = "1.1.1"
url = "https://github.com/GourmandRecipeManager/gourmand"
description = "Recipe Organizer and Shopping List Generator"
long_description = _("""\
Gourmand is an application to store, organize and search recipes.

Features:
* Makes it easy to create shopping lists from recipes.
* Imports recipes from a number of sources, including MealMaster and MasterCook
archives and several popular websites.
* Exports recipes as PDF files, plain text, MealMaster files, HTML web pages,
and a custom XML format for exchange with other Gourmet users.
* Supports linking images with recipes.
* Can calculate nutritional information for recipes based on the ingredients.
""")
author = "Gourmand Team and Contributors"
authors = [] # FIXME: get list of contributors
maintainer = "Cyril Danilevski"
maintainer_email = "[email protected]"
artists = [_("Nyall Dawson (cookie icon)"),
_("Kati Pregartner (splash screen image)")]
license = "GPL v2"
117 changes: 117 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/backends/DatabaseChooser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import os.path
from pkgutil import get_data

from gi.repository import Gtk

from gourmand import cb_extras as cb
from gourmand import dialog_extras as de
from gourmand import gglobals
from gourmand.gdebug import debug
from gourmand.i18n import _


class DatabaseChooser:
"""This is a simple interface for getting database information from the user."""
def __init__ (self, okcb=lambda x: debug(x,0), modal=True):
self._okcb = okcb
self.modal = modal
self.possible_dbs = ['sqlite','mysql']
self.need_connection_info = ['mysql']
self.need_file_info = ['sqlite']
self.default_file_directory = gglobals.gourmanddir
self.default_files = {'sqlite':'recipes.db'
}
self.ui = Gtk.Builder()
self.ui.add_from_string(get_data('gourmand', 'ui/databaseChooser.ui').decode())
self.connection_widgets = ['hostEntry','userEntry','pwEntry','dbEntry',
'hostLabel','userLabel','pwLabel','dbLabel',
'pwCheckButton']
self.file_widgets = ['fileEntry','fileButton','fileLabel']
self.widgets = self.file_widgets + self.connection_widgets + ['dbComboBox',
'connectionExpander',
'window']
for w in self.widgets:
setattr(self,w,self.ui.get_object(w))
self.ui.connect_signals(
{'ok_clicked':self.ok_cb,
'cancel_clicked':self.cancel_cb,
'dbChanged':self.change_db_cb,
'browse_clicked':self.browse_cb}
)
self.pwEntry.set_visibility(False)
self.dbComboBox.set_active(0)
self.connectionExpander.set_expanded(False)
self.change_db_cb()
self.window.show()
if self.modal:
self.window.set_modal(True)

def run (self):
if self.modal:
Gtk.mainloop()
return self.retdic

def ok_cb (self, *args):
if not self.current_db:
de.show_message(label='No database selected.',
sublabel='You need to select a database system.')
else:
self.retdic = {'db_backend':self.current_db}
if self.current_db in self.need_connection_info:
for e in self.connection_widgets:
if e.find('Entry') >= 0:
self.retdic[e[0:e.find('Entry')]]=getattr(self,e).get_text()
self.retdic['store_pw']=self.pwCheckButton.get_active()
if self.current_db in self.need_file_info:
fi = self.fileEntry.get_text()
if fi and fi.find(os.path.sep) < 0:
fi = os.path.join(self.default_file_directory,fi)
self.retdic['file']=fi
self.window.hide()
self.window.destroy()
if self._okcb: self._okcb(self.retdic)
if self.modal:
Gtk.mainquit()
return self.retdic

def cancel_cb (self, *args):
self.window.hide()
self.window.destroy()
if self.modal: Gtk.mainquit()


def change_db_cb (self, *args):
self.current_db = None
text = cb.cb_get_active_text(self.dbComboBox)
if not text:
return
for db in self.possible_dbs:
if text.lower().find(db.lower()) >= 0:
self.current_db = db
break
if self.current_db in self.need_connection_info:
self.connectionExpander.set_expanded(True)
for w in self.connection_widgets:
getattr(self,w).show()
else:
for w in self.connection_widgets:
getattr(self,w).hide()
for w in self.file_widgets:
if self.current_db in self.need_file_info:
getattr(self,w).show()
else:
getattr(self,w).hide()
if self.current_db in self.default_files:
self.fileEntry.set_text(self.default_files[self.current_db])

def browse_cb (self,*args):
fi = de.select_file(_("Choose Database File"),
filename=self.default_file_directory,
action=Gtk.FileChooserAction.OPEN)
if fi:
self.fileEntry.set_text(fi)


if __name__ == '__main__':
d = DatabaseChooser(None,modal=True)
print(d.run())
2 changes: 2 additions & 0 deletions .pybuild/cpython3_3.12/build/gourmand/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Database backend stuff should all be in this directory.
#
Loading