[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Problem with a simple QDialog
From: "Alexandre Badez" <alexandre.badez () gmail ! com>
Date: 2007-11-28 13:44:39
Message-ID: 20f595e90711280544k27432385m1c1f697560500906 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Nov 28, 2007 2:23 PM, Andreas Pakulat <apaku@gmx.de> wrote:
> On 28.11.07 13:21:37, Alexandre Badez wrote:
> > On Nov 28, 2007 12:00 PM, Andreas Pakulat <apaku@gmx.de> wrote:
> >
> > > But you can do this inside your dialog class. Just override the accept
> > > and reject methods and do whatever logic you have their.
> > >
> > > It doesn't make sense to have a modal dialog without another window
> > > (i.e. in your __main__ function), as then its not really modal. And
> > > making a modal dialog is exactly what the exec_() does.
> >
> > Exactly, but in this case, I need a modal dialog, that why I use the
> exec_.
>
> So you do have a QApplication created and executed already when you
> create your dialog?
>
Yes I do :)
>
> > My problem is what can make a "Bus Error" when I just simply want to
> create
> > a QDialog (even the simplest one).
>
> I don't know, google turns up a memory-corruption problem as first
> hit... Without some small self-contained example its hard to say what
> could be wrong.
>
> Andreas
That is my problem, and why I ask if somebody know anything about this.
Because, normaly it append after a memory leak (in C/C++ and others), but in
python we do not manage our memory that's my problem.
Ok, here is a bit more of my code.
It's in my own model:
def addIndividu(self, index, lIndividu):
self.beginRemoveRows(
index,
self.rowCount(index),
self.rowCount(index))
# We add the data in the node
node = index.internalPointer()
dProblem = node.addIndividu(lIndividu)
if dProblem is not None and dProblem != {}:
wChapterSelection =
WindowChapterSelectionDialog.WindowChapterSelectionDialog() # <- We create
an instance of the window
# First we verify that all item have a valid type
if dProblem.get('undefied_type') is not None:
dUndef = dProblem.pop('undefied_type')
for typeIndividu in dUndef:
lChapter = dUndef[typeIndividu][0]
lIndividu = dUndef[typeIndividu][1]
for individu in lIndividu:
wChapterSelection.setWindow(typeIndividu, individu,
lChapter)
wChapterSelection.exec_() # <- HERE IS MY PROBLEM !!
: "bus error"
if wChapterSelection.Accepted ==
wChapterSelection.result():
goodChapter = wChapterSelection.getSelection()
goodChapter.addIndividu([individu])
The problem is steel there if I do something like:
def addIndividu(self, index, lIndividu):
self.beginRemoveRows(
index,
self.rowCount(index),
self.rowCount(index))
# We add the data in the node
node = index.internalPointer()
dProblem = node.addIndividu(lIndividu)
if dProblem is not None and dProblem != {}:
wChapterSelection = QtgGui.QDialog() # <- We create an instance
of the window
# First we verify that all item have a valid type
if dProblem.get('undefied_type') is not None:
dUndef = dProblem.pop('undefied_type')
for typeIndividu in dUndef:
lChapter = dUndef[typeIndividu][0]
lIndividu = dUndef[typeIndividu][1]
for individu in lIndividu:
wChapterSelection.exec_() # <- HERE IS MY PROBLEM !!
: "bus error"
if wChapterSelection.Accepted ==
wChapterSelection.result():
print "ok :)"
Thanks for your help
--
Alex
[Attachment #5 (text/html)]
On Nov 28, 2007 2:23 PM, Andreas Pakulat <<a \
href="mailto:apaku@gmx.de">apaku@gmx.de</a>> wrote:<br><div \
class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid \
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div \
class="Ih2E3d">On 28.11.07 13:21:37, Alexandre Badez wrote:<br>> On Nov 28, 2007 \
12:00 PM, Andreas Pakulat <<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>> \
wrote:<br>><br>> > But you can do this inside your dialog class. Just \
override the accept <br>> > and reject methods and do whatever logic you have \
their.<br>> ><br>> > It doesn't make sense to have a modal dialog \
without another window<br>> > (i.e. in your __main__ function), as then its not \
really modal. And <br>> > making a modal dialog is exactly what the exec_() \
does.<br>><br></div><div class="Ih2E3d">> Exactly, but in this case, I need a \
modal dialog, that why I use the exec_.<br><br></div>So you do have a QApplication \
created and executed already when you <br>create your dialog?<br><div \
class="Ih2E3d"></div></blockquote><div><br>Yes I do :)<br> </div><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d"><br>> My problem is what can \
make a "Bus Error" when I just simply want to create<br>> a QDialog \
(even the simplest one).<br><br></div>I don't know, google turns up a \
memory-corruption problem as first <br>hit... Without some small self-contained \
example its hard to say what<br>could be wrong.<br><br>Andreas<font \
color="#888888"></font></blockquote><div><br>That is my problem, and why I ask if \
somebody know anything about this. <br>Because, normaly it append after a memory leak \
(in C/C++ and others), but in python we do not manage our memory that's my \
problem.<br><br><br>Ok, here is a bit more of my code.<br><br>It's in my own \
model:<br> <br> def addIndividu(self, index, \
lIndividu):<br> \
self.beginRemoveRows(<br> \
index,<br> \
self.rowCount(index),<br> \
self.rowCount(index))<br><br> # We add the \
data in the node <br> node = \
index.internalPointer()<br> dProblem = \
node.addIndividu(lIndividu)<br> \
<br> if dProblem is not None and dProblem \
!= {}:<br> \
wChapterSelection = WindowChapterSelectionDialog.WindowChapterSelectionDialog () # \
<- We create an instance of the \
window<br><br> # \
First we verify that all item have a valid \
type<br> if \
dProblem.get('undefied_type') is not \
None:<br> \
dUndef = dProblem.pop \
('undefied_type')<br> \
for typeIndividu in dUndef:<br> \
lChapter = dUndef[typeIndividu][0]<br> \
lIndividu = dUndef[typeIndividu][1]<br> \
<br> \
for individu in lIndividu: \
<br> \
wChapterSelection.setWindow(typeIndividu, individu, \
lChapter)<br> \
<br> \
wChapterSelection.exec_() # <- HERE IS MY PROBLEM !! : "bus error" \
<br> \
<br> \
if wChapterSelection.Accepted == \
wChapterSelection.result():<br> & \
nbsp; \
goodChapter = wChapterSelection.getSelection()<br> \
\
goodChapter.addIndividu([individu])<br></div></div><br><br>The problem is steel \
there if I do something like:<br><br> def addIndividu(self, index, \
lIndividu):<br> self.beginRemoveRows(<br>
index,<br>
\
self.rowCount(index),<br> \
\
self.rowCount(index))<br> <br>
# We add the data in the node<br>
node = index.internalPointer()<br>
dProblem = node.addIndividu(lIndividu)<br>
<br>
if dProblem is not None and dProblem != \
{}:<br> \
wChapterSelection = QtgGui.QDialog() # <- We
create an instance of the window<br>
<br>
# First we verify \
that all item have a valid type<br> \
if \
dProblem.get('undefied_type') is not None:<br> \
\
dUndef = dProblem.pop('undefied_type')<br> \
\
for typeIndividu in dUndef:<br> \
\
lChapter = dUndef[typeIndividu][0]<br> \
\
lIndividu = dUndef[typeIndividu][1]<br> \
\
<br> \
for individu in lIndividu: \
<br> \
wChapterSelection.exec_() # <- HERE IS MY PROBLEM !! : "bus error"<br> \
\
<br> \
if wChapterSelection.Accepted == wChapterSelection.result():<br> \
\
print "ok :)"<br><br><br>Thanks for your help<br><br>-- <br>Alex<br>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic