Hello,
I've upgraded my Xubuntu installation from 15.10 to 16.04 yesterday and couldn't start the first Dabo application I tried, because wxpython wasn't installed any more. There is no package python-wxgt2.? any more, only python-wxgtk3.0. So I installed that and got this exception:
sib@gespenst-xubuntu:~/src/dabo/demo$ ./DaboDemo.py Traceback (most recent call last): File "./DaboDemo.py", line 24, in <module> main() File "./DaboDemo.py", line 20, in main app.start() File "/home/sib/src/dabo/dabo/dApp.py", line 388, in start self.setup() File "/home/sib/src/dabo/dabo/dApp.py", line 340, in setup self.initUIApp() File "/home/sib/src/dabo/dabo/dApp.py", line 380, in initUIApp self.uiApp.setup() File "/home/sib/src/dabo/dabo/ui/uiwx/uiApp.py", line 433, in setup frm = self.dApp.MainForm = dabo.ui.createForm(mfc) File "/home/sib/src/dabo/dabo/ui/uiwx/__init__.py", line 1356, in createForm frm = cls(*args, **kwargs) File "/tmp/tmp7FMZLl.py", line 18, in __init__ super(dForm_23131, self).__init__(parent=parent, attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 1044, in __init__ *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 40, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 76, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 58, in _afterInit super(BaseForm, self)._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 96, in _afterInit self.MenuBar = mbc() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuBar.py", line 21, in __init__ pm.dPemMixin.__init__(self, preClass, None, properties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 184, in _afterInit self.fileMenu = self.appendMenu(FileMenu(self, MenuID="base_file")) File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 26, in __init__ super(FileMenu, self).__init__(*args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 47, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 43, in _afterInit help=_("Open up a debug output window")) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 255, in append menutype=menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 238, in _createMenuItem item = _actualCreation(caption, help, picture, menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 232, in _actualCreation _item.Caption = caption File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 95, in _setCaption self._redefine() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 72, in _redefine self.SetBitmap(self.Icon) File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 12543, in SetBitmap return _core_.MenuItem_SetBitmap(*args, **kwargs) wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps sib@gespenst-xubuntu:~/src/dabo/demo$
Is it possible to run Dabo using wxPython 3 (which still calls itself "classic", so it's not the Phoenix version for Python 3)?
Greetings, Sibylle
The simple answer is YES. You will need Dabo2 and not the standard one. There is a version on github but it a little out of date. So I just send you one.
Johnf
On 04/26/2016 08:46 AM, Sibylle Koczian wrote:
Hello,
I've upgraded my Xubuntu installation from 15.10 to 16.04 yesterday and couldn't start the first Dabo application I tried, because wxpython wasn't installed any more. There is no package python-wxgt2.? any more, only python-wxgtk3.0. So I installed that and got this exception:
sib@gespenst-xubuntu:~/src/dabo/demo$ ./DaboDemo.py Traceback (most recent call last): File "./DaboDemo.py", line 24, in <module> main() File "./DaboDemo.py", line 20, in main app.start() File "/home/sib/src/dabo/dabo/dApp.py", line 388, in start self.setup() File "/home/sib/src/dabo/dabo/dApp.py", line 340, in setup self.initUIApp() File "/home/sib/src/dabo/dabo/dApp.py", line 380, in initUIApp self.uiApp.setup() File "/home/sib/src/dabo/dabo/ui/uiwx/uiApp.py", line 433, in setup frm = self.dApp.MainForm = dabo.ui.createForm(mfc) File "/home/sib/src/dabo/dabo/ui/uiwx/__init__.py", line 1356, in createForm frm = cls(*args, **kwargs) File "/tmp/tmp7FMZLl.py", line 18, in __init__ super(dForm_23131, self).__init__(parent=parent, attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 1044, in __init__ *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 40, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 76, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 58, in _afterInit super(BaseForm, self)._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 96, in _afterInit self.MenuBar = mbc() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuBar.py", line 21, in __init__ pm.dPemMixin.__init__(self, preClass, None, properties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 184, in _afterInit self.fileMenu = self.appendMenu(FileMenu(self, MenuID="base_file")) File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 26, in __init__ super(FileMenu, self).__init__(*args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 47, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 43, in _afterInit help=_("Open up a debug output window")) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 255, in append menutype=menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 238, in _createMenuItem item = _actualCreation(caption, help, picture, menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 232, in _actualCreation _item.Caption = caption File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 95, in _setCaption self._redefine() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 72, in _redefine self.SetBitmap(self.Icon) File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 12543, in SetBitmap return _core_.MenuItem_SetBitmap(*args, **kwargs) wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps sib@gespenst-xubuntu:~/src/dabo/demo$
Is it possible to run Dabo using wxPython 3 (which still calls itself "classic", so it's not the Phoenix version for Python 3)?
Greetings, Sibylle
Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/711e94b2-3bff-a402-88db-712bd395ddca@t-onlin...
I installed Ubuntu 16.04 (a VM) today and I got the same error message. This will take a while to figure out. But I'm starting.
BTW Ubuntu drives me crazy with SUDO stuff.
Johnf
On 04/26/2016 08:46 AM, Sibylle Koczian wrote:
Hello,
I've upgraded my Xubuntu installation from 15.10 to 16.04 yesterday and couldn't start the first Dabo application I tried, because wxpython wasn't installed any more. There is no package python-wxgt2.? any more, only python-wxgtk3.0. So I installed that and got this exception:
sib@gespenst-xubuntu:~/src/dabo/demo$ ./DaboDemo.py Traceback (most recent call last): File "./DaboDemo.py", line 24, in <module> main() File "./DaboDemo.py", line 20, in main app.start() File "/home/sib/src/dabo/dabo/dApp.py", line 388, in start self.setup() File "/home/sib/src/dabo/dabo/dApp.py", line 340, in setup self.initUIApp() File "/home/sib/src/dabo/dabo/dApp.py", line 380, in initUIApp self.uiApp.setup() File "/home/sib/src/dabo/dabo/ui/uiwx/uiApp.py", line 433, in setup frm = self.dApp.MainForm = dabo.ui.createForm(mfc) File "/home/sib/src/dabo/dabo/ui/uiwx/__init__.py", line 1356, in createForm frm = cls(*args, **kwargs) File "/tmp/tmp7FMZLl.py", line 18, in __init__ super(dForm_23131, self).__init__(parent=parent, attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 1044, in __init__ *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 40, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 76, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dForm.py", line 58, in _afterInit super(BaseForm, self)._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dFormMixin.py", line 96, in _afterInit self.MenuBar = mbc() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuBar.py", line 21, in __init__ pm.dPemMixin.__init__(self, preClass, None, properties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 184, in _afterInit self.fileMenu = self.appendMenu(FileMenu(self, MenuID="base_file")) File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 26, in __init__ super(FileMenu, self).__init__(*args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 47, in __init__ attProperties=attProperties, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__ self._afterInit() File "/home/sib/src/dabo/dabo/ui/uiwx/dBaseMenuBar.py", line 43, in _afterInit help=_("Open up a debug output window")) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 255, in append menutype=menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 238, in _createMenuItem item = _actualCreation(caption, help, picture, menutype, *args, **kwargs) File "/home/sib/src/dabo/dabo/ui/uiwx/dMenu.py", line 232, in _actualCreation _item.Caption = caption File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 95, in _setCaption self._redefine() File "/home/sib/src/dabo/dabo/ui/uiwx/dMenuItem.py", line 72, in _redefine self.SetBitmap(self.Icon) File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 12543, in SetBitmap return _core_.MenuItem_SetBitmap(*args, **kwargs) wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps sib@gespenst-xubuntu:~/src/dabo/demo$
Is it possible to run Dabo using wxPython 3 (which still calls itself "classic", so it's not the Phoenix version for Python 3)?
Greetings, Sibylle
Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/711e94b2-3bff-a402-88db-712bd395ddca@t-onlin...
On 04/26/2016 08:46 AM, Sibylle Koczian wrote:
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps sib@gespenst-xubuntu:~/src/dabo/demo$
Is it possible to run Dabo using wxPython 3 (which still calls itself "classic", so it's not the Phoenix version for Python 3)?
Ok I'm in trouble at this point. I know that your issue is related to the 'menutype= "check" ' in dBaseMenuBar.py. But if I change the menuitems to just normal items the window will open but it will not display any menus??? (see below) I also noticed that the path to the icons that dBaseMenuBar.py did not include 'icons'in the path. But that didn't really help. But I believe I could fix the issue - but I doubt that it's the real issue.
So what I did find is that the menu would appear when I forced the window to full screen and clicked on the top title bar (but without icons). I'm guessing this is an issue with Ubuntu and NOT Dabo and not wxPython because I get exact the same issue when opening wxPython demo.py. When demo.py opens with anything less than full screen the menu does not appear. When I open dBaseMneu.py with anything other than full screen the menu does not appear (this is after I removed the menutype as check). IOW the menu will appear if I force the frame/window to full screen but you have to click on the title bar.
I really don't know Ubuntu at all. Maybe this is some setting that has to be changed - sort of like how windows can hide the bottom icon bar.
I haven't move to Ubuntu because I don't like Unity. And now I have one more reason!
So Sibylle, maybe you can tell me how to change the way Unity works to allow the menu to appear anytime the window is open?
Johnf
****
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
You might want to check out this: http://askubuntu.com/questions/762137/applications-menu-missing-from-menu-ba...
Johnf
On 05/04/2016 06:34 PM, john wrote:
On 04/26/2016 08:46 AM, Sibylle Koczian wrote:
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps sib@gespenst-xubuntu:~/src/dabo/demo$
Is it possible to run Dabo using wxPython 3 (which still calls itself "classic", so it's not the Phoenix version for Python 3)?
Ok I'm in trouble at this point. I know that your issue is related to the 'menutype= "check" ' in dBaseMenuBar.py. But if I change the menuitems to just normal items the window will open but it will not display any menus??? (see below) I also noticed that the path to the icons that dBaseMenuBar.py did not include 'icons'in the path. But that didn't really help. But I believe I could fix the issue - but I doubt that it's the real issue.
So what I did find is that the menu would appear when I forced the window to full screen and clicked on the top title bar (but without icons). I'm guessing this is an issue with Ubuntu and NOT Dabo and not wxPython because I get exact the same issue when opening wxPython demo.py. When demo.py opens with anything less than full screen the menu does not appear. When I open dBaseMneu.py with anything other than full screen the menu does not appear (this is after I removed the menutype as check). IOW the menu will appear if I force the frame/window to full screen but you have to click on the title bar.
I really don't know Ubuntu at all. Maybe this is some setting that has to be changed - sort of like how windows can hide the bottom icon bar.
I haven't move to Ubuntu because I don't like Unity. And now I have one more reason!
So Sibylle, maybe you can tell me how to change the way Unity works to allow the menu to appear anytime the window is open?
Johnf
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Am 05.05.2016 um 03:34 schrieb john:
Ok I'm in trouble at this point. I know that your issue is related to the 'menutype= "check" ' in dBaseMenuBar.py. But if I change the menuitems to just normal items the window will open but it will not display any menus??? (see below) I also noticed that the path to the icons that dBaseMenuBar.py did not include 'icons'in the path. But that didn't really help. But I believe I could fix the issue - but I doubt that it's the real issue.
So what I did find is that the menu would appear when I forced the window to full screen and clicked on the top title bar (but without icons). I'm guessing this is an issue with Ubuntu and NOT Dabo and not wxPython because I get exact the same issue when opening wxPython demo.py. When demo.py opens with anything less than full screen the menu does not appear. When I open dBaseMneu.py with anything other than full screen the menu does not appear (this is after I removed the menutype as check). IOW the menu will appear if I force the frame/window to full screen but you have to click on the title bar.
I think you're right: this seems to be Ubuntu, and moreover not every Ubuntu flavour. I wasn't clear enough about my installation: I'm using Xubuntu, which is Ubuntu with the XFCE desktop. Never looked at Unity. If I comment out the SetBitmaps() call from dMenuItem.py I get the menu quite normally, even most of the icons are there. So I'd suspect a Unity problem, not Dabo, not wxPython and not even Ubuntu as a distribution.
I get other Dabo problems, though, which I'll show as soon as I've got a small example.
I really don't know Ubuntu at all. Maybe this is some setting that has to be changed - sort of like how windows can hide the bottom icon bar.
I haven't move to Ubuntu because I don't like Unity. And now I have one more reason!
So Sibylle, maybe you can tell me how to change the way Unity works to allow the menu to appear anytime the window is open?
Did you try any of the solutions in the link you sent in your other mail? Or, of course, if you don't like Unity anyway, you might change over to XFCE or another desktop, Ubuntu supports several.
Greetings Sibylle
On 05/05/2016 01:26 AM, Sibylle Koczian wrote:
I think you're right: this seems to be Ubuntu, and moreover not every Ubuntu flavour. I wasn't clear enough about my installation: I'm using Xubuntu, which is Ubuntu with the XFCE desktop. Never looked at Unity. If I comment out the SetBitmaps() call from dMenuItem.py I get the menu quite normally, even most of the icons are there. So I'd suspect a Unity problem, not Dabo, not wxPython and not even Ubuntu as a distribution.
I get other Dabo problems, though, which I'll show as soon as I've got a small example.
Oh I tried all of the solutions in the link I provided. As the link suggested it's not just wxPython but almost any GTK program I ran - including gedit.
The only issue with just commenting out the SetBitmaps() is you will lose function. The checkbox and the icons are suppose to be there and work. That said, on production code I remove/replace the tools under the 'File' menu so I guess you don't really need the icons because the hot-key will work.
One other hint - I deleted all of the pyc files. After restarting and completing the re-compile I got a very noticeable increase in performance. I used 'find / -name "*.pyc" -delete.
Johnf
Am 05.05.2016 um 15:23 schrieb john:
On 05/05/2016 01:26 AM, Sibylle Koczian wrote:
I get other Dabo problems, though, which I'll show as soon as I've got a small example.
At the moment it's only one problem: dForm.next() doesn't work with Dabo 2. Example given below.
Oh I tried all of the solutions in the link I provided. As the link suggested it's not just wxPython but almost any GTK program I ran - including gedit.
Yes, I saw it. Nothing like that with XFCE.
The only issue with just commenting out the SetBitmaps() is you will lose function. The checkbox and the icons are suppose to be there and work. That said, on production code I remove/replace the tools under the 'File' menu so I guess you don't really need the icons because the hot-key will work.
I've never yet used them, I think, so that's not a show stopper.
One other hint - I deleted all of the pyc files. After restarting and completing the re-compile I got a very noticeable increase in performance. I used 'find / -name "*.pyc" -delete.
That deletes all pyc files, my own and those belonging to Python itself, right? Should be repeated before every start of a Python application, shouldn't it? Or only after changes?
Here is my example for dForm.next, reasonably small, I hope. Clicking ">" gives this exception:
Traceback (most recent call last): File "/home/sib/src/neues_dabo2/dabo/ui/uiwx/dControlMixin.py", line 27, in _onWxHit self.raiseEvent(dEvents.Hit, evt, *args, **kwargs) File "/home/sib/src/neues_dabo2/dabo/ui/uiwx/dPemMixin.py", line 1086, in raiseEvent super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, **kwargs) File "/home/sib/src/neues_dabo2/dabo/lib/eventMixin.py", line 81, in raiseEvent bindingFunction(event) File "./testnumtx_sqlite.py", line 96, in onNext self.next() File "/home/sib/src/neues_dabo2/dabo/ui/uiwx/dForm.py", line 362, in next self._moveRecordPointer(bizobj.__next__, dataSource) File "/home/sib/src/neues_dabo2/dabo/ui/uiwx/dForm.py", line 271, in _moveRecordPointer response = func(*args, **kwargs) File "/home/sib/src/neues_dabo2/dabo/biz/dBizobj.py", line 359, in __next__ next(self._CurrentCursor) StopIteration
Clicking the other buttons works as expected.
SQLite database textnum.sqlite:
CREATE TABLE foo ( pkid INTEGER PRIMARY KEY, name VARCHAR(30), number INTEGER); INSERT INTO foo (name, number) VALUES ('red', 2); INSERT INTO foo (name, number) VALUES ('green', 8); INSERT INTO foo (name, number) VALUES ('yellow', 7); INSERT INTO foo (name) VALUES ('blue');
Connection file (with my path to the database):
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <connectiondefs xmlns="http://www.dabodev.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dabodev.com conn.xsd" xsi:noNamespaceSchemaLocation = "http://dabodev.com/schema/conn.xsd">
<connection dbtype="SQLite"> <name>textnum_conn</name> <host></host> <database>../../sqlite_db/textnum.sqlite</database> <user></user> <password></password> <port></port> </connection> </connectiondefs>
Dabo script:
#!/usr/bin/env python # -*- coding: utf-8 -*-
import dabo dabo.ui.loadUI("wx")
class BizFoo(dabo.biz.dBizobj):
def afterInit(self): self.DataSource = "foo" self.KeyField = "pkid" self.addFrom("foo") self.addField("pkid") self.addField("name") self.addField("number")
self.DataStructure = ( ("pkid", "I", True, "foo", "pkid"), ("name", "C", False, "foo", "name"), ("number", "I", False, "foo", "number"), )
class TestForm(dabo.ui.dForm):
def afterInit(self): self.Sizer = dabo.ui.dSizer("v") pn = dabo.ui.dPanel(self) self.Sizer.append1x(pn) pn.Sizer = vsp = dabo.ui.dSizer("v") grpn = self.makeGridPanel(pn) vsp.append1x(grpn, border=10) recpn = self.makeRecordPanel(pn) vsp.append1x(recpn, border=10) btx = self.makeButtonBox(pn) vsp.append(btx, 0, "x", border=10) self.layout()
def afterInitAll(self): self.requery()
def createBizobjs(self): self.Application.addConnectFile("textnum_sqlite.cnxml") conn = self.Application.getConnectionByName("textnum_conn") biz = BizFoo(conn) self.addBizobj(biz)
def makeGridPanel(self, parent): rpn = dabo.ui.dPanel(parent) rpn.Sizer = vs = dabo.ui.dSizer("v") gr = dabo.ui.dGrid(rpn, AlternateRowColoring=True, ColumnCount=3, SelectionMode="Row", DataSource="foo") cols = [("ID", "pkid"), ("Name", "name"), ("Number", "number")] for (i, (cpt, fld)) in enumerate(cols): gr.Columns[i].Caption = cpt gr.Columns[i].DataField = fld vs.append1x(gr) return rpn
def makeRecordPanel(self, parent): rpn = dabo.ui.dPanel(parent) rpn.Sizer = gs = dabo.ui.dGridSizer(MaxCols=2, HGap=3, VGap=3) gs.append(dabo.ui.dLabel(rpn, Caption="ID")) gs.append(dabo.ui.dTextBox(rpn, DataSource="foo", DataField="pkid", ReadOnly=True), "x") gs.append(dabo.ui.dLabel(rpn, Caption="Name")) gs.append(dabo.ui.dTextBox(rpn, DataSource="foo", DataField="name"), "x") gs.append(dabo.ui.dLabel(rpn, Caption="Number")) gs.append(dabo.ui.dTextBox(rpn, DataSource="foo", DataField="number"), "x") gs.setColExpand(True, 1) return rpn
def makeButtonBox(self, parent): rpn = dabo.ui.dPanel(parent) rpn.Sizer = hs = dabo.ui.dSizer("h") hs.append(dabo.ui.dButton(rpn, Caption="|<", OnHit=self.onFirst), "x") hs.append(dabo.ui.dButton(rpn, Caption="<", OnHit=self.onPrior), "x") hs.append(dabo.ui.dButton(rpn, Caption=">", OnHit=self.onNext), "x") hs.append(dabo.ui.dButton(rpn, Caption=">|", OnHit=self.onLast), "x") hs.append(dabo.ui.dButton(rpn, Caption="Save", OnHit=self.onSave), "x") hs.append(dabo.ui.dButton(rpn, Caption="Cancel", OnHit=self.onCancel), "x") return rpn
def onSave(self, evt): self.save()
def onCancel(self, evt): self.cancel()
def onNext(self, evt): self.next()
def onPrior(self, evt): self.prior()
def onFirst(self, evt): self.first()
def onLast(self, evt): self.last()
if __name__ == "__main__": app = dabo.dApp() app.MainFormClass = TestForm app.start()
Greetings, Sibylle
On 05/05/2016 07:45 AM, Sibylle Koczian wrote:
At the moment it's only one problem: dForm.next() doesn't work with Dabo 2. Example given below.
Of course it doesn't - it's the only one that is called differently "next(self)' instead of self.next(). And the routines are recursive. I'll check into the problem and see what I can find. I don't normally use next() for anything (actually I don't use any of the move methods) in my programs.
Thanks for the code. BTW I normally pass the Datasource and that might a source of the issue - just guessing!
Johnf
On 05/05/2016 11:19 AM, john wrote:
On 05/05/2016 07:45 AM, Sibylle Koczian wrote:
At the moment it's only one problem: dForm.next() doesn't work with Dabo 2. Example given below.
Of course it doesn't - it's the only one that is called differently "next(self)' instead of self.next(). And the routines are recursive. I'll check into the problem and see what I can find. I don't normally use next() for anything (actually I don't use any of the move methods) in my programs.
Thanks for the code. BTW I normally pass the Datasource and that might a source of the issue - just guessing!
Johnf
OK I haven't been able to fix the next(). This is not the first time I've had this trouble (had it even with the old Dabo). If I had to guess I would say that neither Sqlite or Postgres dbapi modules (sqlite3, psycopg) have a "__iter__" method. Ed and Paul worked mostly with MySQLdb which does have the "__iter__". They may have thought all database modules had it. But I don't really know. Anyway, that's why I think we get the "StopIteration:" exception. Of course this is just a guess and I could be completely wrong!
In the past I have always just made my own next() by: Create my own next method and then do get the cursor get the current pk add one to the pk movetoPK(pk)
This works for me because all my PK's are integers. It would not work for other types of PK's.
I've written dabo-dev asking how next() is suppose work. Let's hope that they have an answer and maybe a fix.
Johnf
On 05/05/2016 06:51 PM, john wrote:
If I had to guess I would say that neither Sqlite or Postgres dbapi modules (sqlite3, psycopg) have a "__iter__" method.
I'm sorry I misspoke in the above. What I mean is that I have not discovered a way to expose the__iter__ method to allow my use. I realize that Sqlite and Psycopg2 have the method I just can't get them to work. With MySQL.cursor I can see the __iter__.next method. It's there and easy to see and it works. With psycopg2 I can't just say psycopg.cursor.__iter__.next(). Because it does not work.
Maybe there is some other way to call this or it needs some sort of data?
Johnf
On 05/06/2016 07:43 AM, john wrote:
On 05/05/2016 06:51 PM, john wrote:
If I had to guess I would say that neither Sqlite or Postgres dbapi modules (sqlite3, psycopg) have a "__iter__" method.
I'm sorry I misspoke in the above. What I mean is that I have not discovered a way to expose the__iter__ method to allow my use. I realize that Sqlite and Psycopg2 have the method I just can't get them to work. With MySQL.cursor I can see the __iter__.next method. It's there and easy to see and it works. With psycopg2 I can't just say psycopg.cursor.__iter__.next(). Because it does not work.
Maybe there is some other way to call this or it needs some sort of data?
Johnf
BTW here is the source for __iter__
def__iter__(self):ifself._prefetch:res =super(DictCursorBase,self).__iter__()first =res.next()ifself._query_executed:self._build_index()ifnotself._prefetch:res =super(DictCursorBase,self).__iter__()first =res.next()yieldfirst while1:yieldres.next()
Of course it fails at first = res.next()
Johnf
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Am 06.05.2016 um 16:46 schrieb john:
On 05/06/2016 07:43 AM, john wrote:
BTW here is the source for __iter__
Which __iter__, in which class?
def__iter__(self):ifself._prefetch:res =super(DictCursorBase,self).__iter__()first =res.next()ifself._query_executed:self._build_index()ifnotself._prefetch:res =super(DictCursorBase,self).__iter__()first =res.next()yieldfirst while1:yieldres.next()
This has been badly mangled on the way, as you see. I failed to restore the missing indentation at the second "if". Could you try again, or tell me where this comes from?
Thank you, Sibylle
On 05/07/2016 03:46 AM, Sibylle Koczian wrote:
Am 06.05.2016 um 16:46 schrieb john:
On 05/06/2016 07:43 AM, john wrote:
BTW here is the source for __iter__
Which __iter__, in which class?
def__iter__(self):ifself._prefetch:res =super(DictCursorBase,self).__iter__()first =res.next()ifself._query_executed:self._build_index()ifnotself._prefetch:res
=super(DictCursorBase,self).__iter__()first =res.next()yieldfirst while1:yieldres.next()
This has been badly mangled on the way, as you see. I failed to restore the missing indentation at the second "if". Could you try again, or tell me where this comes from?
Thank you, Sibylle
Sorry about that - the code is from psycopg2.extras. Which is the way I get a DictCursor.
https://github.com/psycopg/psycopg2/blob/master/lib/extras.py
That's where code is stored.
Johnf
Am 06.05.2016 um 03:51 schrieb john:
On 05/05/2016 11:19 AM, john wrote:
Thanks for the code. BTW I normally pass the Datasource and that might a source of the issue - just guessing!
I don't think so. One of my Dabo applications uses next(mydatasource) and that doesn't work either.
OK I haven't been able to fix the next(). This is not the first time I've had this trouble (had it even with the old Dabo). If I had to guess I would say that neither Sqlite or Postgres dbapi modules (sqlite3, psycopg) have a "__iter__" method. Ed and Paul worked mostly with MySQLdb which does have the "__iter__". They may have thought all database modules had it. But I don't really know. Anyway, that's why I think we get the "StopIteration:" exception. Of course this is just a guess and I could be completely wrong!
I never had issues with next() before, and I'm using it in several applications, mostly with PostgreSQL, sometimes with SQLite.
In the past I have always just made my own next() by: Create my own next method and then do get the cursor get the current pk add one to the pk movetoPK(pk)
This works for me because all my PK's are integers. It would not work for other types of PK's.
It would only work if your PK's are (and stay) continuous, no deleting of records. And if the records are sorted by PK.
I've written dabo-dev asking how next() is suppose work. Let's hope that they have an answer and maybe a fix.
I hope so too.
Thank you, Sibylle