-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgnc_commodity_edit.py
37 lines (24 loc) · 1.13 KB
/
gnc_commodity_edit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# what the hell is going on here
# this is creating a new general select dialog
# but the dialog is defined in dialog-commodity.c
import traceback
import pdb
from gnc_general_select import GncGeneralSelect
from dialog_commodity import DialogCommodity
# not clear what to do here
# is GncCommodityEdit a subclass of GncGeneralSelect
# no - we need to be a subclass of GncGeneralSelect
class GncCommodityEdit(GncGeneralSelect):
def __init__ (self):
super(GncCommodityEdit,self).__init__(GncGeneralSelect.GNC_GENERAL_SELECT_TYPE_SELECT,
self.get_string, self.new_select, None)
def get_string (self, ptr):
print("GncCommodityEdit get_string",ptr)
# in C this involves a type conversion
return ptr.get_printname()
def new_select (self, mode_ptr, comm, toplevel):
print("GncCommodityEdit new_select",mode_ptr, comm, toplevel)
# lots of type conversions
mode = mode_ptr if mode_ptr != None else DialogCommodity.DIAG_COMM_ALL
newobj = DialogCommodity.gnc_ui_select_commodity_modal(comm, toplevel, mode)
return newobj.run()