473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

[PMW 1.2] Dialog controls vanish upon editing

Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the
first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to
be. They also reapper if I change to an other app and then come back again.
I guess this is because a window update is issued by the OS.

What do I miss?
Many thanks in advance and kind regards
Franz GEIGER
Code:

class QCWidgetNumberEditor(_Editor):
'''
+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+ Drop-down. Offers only
existing
Parameter name | |V| parameters, i.e. you have to
first
+--------------------+-+ create at least one parameter.
'''

def __init__(self, parent, x, y, traits=None):
_Editor.__init__(self, parent)
self._pos = (x, y)
self._traits = traits
self._isEditable = Tkinter.IntVar(0)
self._createAndPackEntryFields_()
return

def traits(self):
return self._traits

def _createAndPackEntryFields_(self):

w = Tkinter.Label(self.interior(),
pady = 20
)
w.pack(expand = 1, fill = 'both', padx = 4, pady = 4)

parent = w

# Create and pack the EntryFields.
nameId = ''
if self._traits:
nameId = self._traits.name()
self._tkwNameId = Pmw.EntryField(parent,
labelpos = 'w',
value = nameId,
label_text = 'Name of number
control:',
validate = self._validateNameId_,
modifiedcommand =
self._onChangedNameId_,
command = self._onNameId_
)
textDisplayed = ''
if self._traits:
textDisplayed = self._traits.textHead()
self._tkwTextDisplayedHead = Pmw.EntryField(parent,
labelpos = 'w',
value = textDisplayed,
label_text = 'Caption text
head:',
# validate = {'validator' :
'real',
# 'min' : 10,
'max' : 99, 'minstrict' : 0
# },
modifiedcommand =
self._onChangedTextDisplayedHead_
)
textDisplayed = '1'
if self._traits:
textDisplayed = str(self._traits.numDigitsExclSign())
self._tkwNumDigitsExclSign = Pmw.EntryField(parent,
labelpos = 'w',
value = textDisplayed,
label_text = '# Digits w/o
sign:',
validate = {'validator' :
'integer',
'min' : 1,
'max' : 5, # 'minstrict' : 0
},
modifiedcommand =
self._onChangedNumDigits_
)
textDisplayed = ''
if self._traits:
textDisplayed = self._traits.textTail()
self._tkwTextDisplayedTail = Pmw.EntryField(parent,
labelpos = 'w',
value = textDisplayed,
label_text = 'Caption text
tail:',
modifiedcommand =
self._onChangedTextDisplayedTail_
)

if self._traits:
self._isEditable.set(self._traits.isEditable())
else:
self._isEditable.set(0)
tkwIsEditable = Tkinter.Checkbutton(parent,
variable=self._isEditable,
text='Editable on target',
command=self._onToggleIsEditable_
)

paramNames = Proxy.DataProxy().parameterNames()
self._tkwParamName = Pmw.ComboBox(parent,
labelpos = 'nw',
scrolledlist_items=paramNames,
label_text="Parameter name"
)
i = 0
if self._traits:
paramName = self._traits.parameterName()
try: i = paramNames.index(paramName)
except ValueError:
pass

try:
self._tkwParamName.selectitem(Proxy.DataProxy().pa rameterNames()[i])
except IndexError: pass

entries = (self._tkwNameId,
self._tkwTextDisplayedHead,
self._tkwNumDigitsExclSign,
self._tkwTextDisplayedTail,
tkwIsEditable,
self._tkwParamName
)

for entry in entries:
entry.pack(fill='x', expand=1, padx=10, pady=5)
Pmw.alignlabels(entries)

self._tkwNameId.component('entry').focus_set()

return

def _execute_(self, event):
if event == 'OK':
nameId = self._tkwNameId.getvalue()
textDisplayedHead = self._tkwTextDisplayedHead.getvalue()
numDigits = int(self._tkwNumDigitsExclSign.getvalue())
textDisplayedTail = self._tkwTextDisplayedTail.getvalue()
isEditable = self._isEditable.get()
paramName = self._tkwParamName.get()
if nameId and numDigits > 0 and paramName:
param = Proxy.DataProxy().parameters(paramName)
self._traits = QCWidgetTraits.QCWidgetNumberTraits(nameId,
self._pos[0],
self._pos[1],

textDisplayedHead,
numDigits,

textDisplayedTail,
isEditable,
paramName
)

self.deactivate()
return

def _onChangedTextDisplayedHead_(self):
text = self._tkwTextDisplayedHead.getvalue()
return

def _onChangedNameId_(self):
return

def _onChangedNumDigits_(self):
text = self._tkwNumDigitsExclSign.getvalue()
return

def _onChangedTextDisplayedTail_(self):
text = self._tkwTextDisplayedTail.getvalue()
return

def _onToggleIsEditable_(self):
return

def _onNameId_(self):
return

def _validateFunName_(self, text):
return 1 # 2DO

def _validateNameId_(self, text):
if Proxy.DataProxy().parameterExists(text):
return -1
return 1


Jul 18 '05 #1
2 1528
F. GEIGER wrote:
Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the
first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to
be. They also reapper if I change to an other app and then come back
again. I guess this is because a window update is issued by the OS.

What do I miss?
I would guess that
def _validateNameId_(self, text):
if Proxy.DataProxy().parameterExists(text):
return -1
return 1


is either awfully slow and/or throws an exception.

You could easily verify this assumption with

(a)
def _validateNameId_(self, text):
return 1

and
(b)
def _validateNameId_(self, text):
try:
if Proxy.DataProxy().parameterExists(text):
return -1
return 1
except: # generally a bad idea
print >> sys.stderr, "something went wrong"
return 1
Peter
Jul 18 '05 #2
Thanks Peter,

but this method doesn't seem to be the reason. I placed a "return 1" as the
first statement in its body. No change for the better.

Kind regards
Franz GEIGER

"Peter Otten" <__*******@web.de> schrieb im Newsbeitrag
news:bl*************@news.t-online.com...
F. GEIGER wrote:
Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to be. They also reapper if I change to an other app and then come back
again. I guess this is because a window update is issued by the OS.

What do I miss?


I would guess that
def _validateNameId_(self, text):
if Proxy.DataProxy().parameterExists(text):
return -1
return 1


is either awfully slow and/or throws an exception.

You could easily verify this assumption with

(a)
def _validateNameId_(self, text):
return 1

and
(b)
def _validateNameId_(self, text):
try:
if Proxy.DataProxy().parameterExists(text):
return -1
return 1
except: # generally a bad idea
print >> sys.stderr, "something went wrong"
return 1
Peter

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: F. GEIGER | last post by:
Hi again, I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into...
0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
1
by: Greg | last post by:
I'm trying to create a megawidget for file selection that contains a Label, EntryField, and Browse Button (that will open a tkFileDialog). The label positioning won't cooperate however, could...
1
by: stewart | last post by:
I'm writing an app that requires a 3-level optionMenu display. Basically I'm showing the contents of a 3-dimensional matrix. You choose the first level in the first optionMenu, the 2nd level in...
0
by: David Vaughan | last post by:
py2exe and Pmw problem ---------------------- I was really surprised not to find some faq setting out what to do to get py2exe working for a program using Pmw. I'm haemorrhaging time here, and...
10
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
0
by: nisyna | last post by:
I have a Pmw.ScrolledCanvas that shows some informations taken from an xml file that i have to dowload every time i open my application. But dowloading the files takes some time and I need to give...
2
by: Gord | last post by:
Is it possible to get a table type grid to appear on a custom dialog form? Basically, get the same thing as when you open a table in Datasheet view and can edit the individual columns. I'd like to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.