7 threads found!
Thread | Author | Replies | Views | Last Reply |
---|---|---|---|---|
JTrout | 8 | 102 | ||
JTrout | 18 | 321 | ||
JTrout | 2 | 74 | ||
JTrout | 6 | 129 | ||
JTrout | 4 | 141 | ||
JTrout | 18 | 471 | ||
JTrout | 5 | 303 |
25 comments found!
Hi, again
I can't get the expected behavior of callback in Poser.
It seems the event can't get the chance when it is handled.
The following sample code doesn't do an expected behavior with poser.
The program which has the same event structure do an expected behavior without poser.
What do I mistake?
#-------------------------------------------------------------
import poser
import wx, wx.aui, wx.lib.newevent
import threading, time
(UpdateButtonEvent, EVT_UPDATE_BUTTON) = wx.lib.newevent.NewEvent()
(UpdateCountEvent, EVT_UPDATE_COUNT) = wx.lib.newevent.NewEvent()
class UserEvaluationView(wx.Panel):
def init(self, model, *args, *kwds):
super(UserEvaluationView, self).init(args, kwds)
self.countLabel = wx.StaticText(id=wx.ID_ANY,parent=self, label='', name='count', size = (100,30), style=0)
self.startButton = wx.Button(self, wx.ID_ANY,"Start", size=(45,20))
self.startButton.Bind(wx.EVT_BUTTON, self.OnStart)
self.abortButton = wx.Button(self, wx.ID_ANY,"Abort", size=(45,20))
self.abortButton.Bind(wx.EVT_BUTTON, self.OnAbort)
self.abortButton.Disable()
vLayout1 = wx.BoxSizer(wx.VERTICAL)
vLayout1.Add(self.countLabel, flag=wx.ALIGN_LEFT|wx.ALL, border=5)
vLayout1.Add(self.startButton, flag=wx.ALIGN_LEFT|wx.ALL, border=5)
vLayout1.Add(self.abortButton, flag=wx.ALIGN_LEFT|wx.ALL, border=5)
self.SetSizerAndFit(vLayout1)
** self.Bind(EVT_UPDATE_BUTTON, self.OnUpdateButton)
** self.Bind(EVT_UPDATE_COUNT, self.OnUpdateCount)
self.thread = None
def OnStart(self, event):
if self.thread == None:
self.thread = TestThread(self)
self.thread.start()
def OnAbort(self, event):
if self.thread != None:
self.thread.abort()
def setForRunning(self):
self.startButton.Disable()
self.abortButton.Enable()
def setForStop(self):
self.startButton.Enable()
self.abortButton.Disable()
def OnUpdateButton(self, event):
if event.name == "start":
self.setForRunning()
elif event.name== "stop":
self.setForStop()
self.Refresh()
def OnUpdateCount(self, event):
self.countLabel.SetLabel('%3i' % event.count)
class TestThread(threading.Thread):
def init(self, aView):
threading.Thread.init(self)
self.view = aView
self.setDaemon(True)
self.abortInvoked = False
def run(self):
** event = UpdateButtonEvent(name="start")**
** wx.PostEvent(self.view, event) **
for i in range(20): # for safety
if self.abortInvoked:
break
** event = UpdateCountEvent(count=i)**
** wx.PostEvent(self.view, event)**
# Actually, various processing is put here.
time.sleep(1) # TBD
** event = UpdateButtonEvent(name="stop")**
** wx.PostEvent(self.view, event)**
self.view.thread = None
def abort(self):
self.abortInvoked=True
def main():
model = None # dummy
man = poser.WxAuiManager()
root = man.GetManagedWindow()
panel = UserEvaluationView(model, parent=root)
pinfo = wx.aui.AuiPaneInfo()pinfo.CloseButton(True).DestroyOnClose(True).Resizable().Float().FloatingSize(wx.Size(200, 200)).BestSize(wx.Size(200, 200))
man.AddPane(panel, pinfo)
pinfo.Show()
man.Update()
main()
#-------------------------------------------------------------
Thread: A multithreading in Poser Python. | Forum: Poser Python Scripting
A so-called queuing model itself is easy to understand.
Therefore, I think that "the program that only main thread calls API of wx" is the most reliable.
However, won't the event hand ring mechanism of wx have a more convenient structure?
I am expecting that it is combination with the event hand ring model of wx that I seem probably to have difficulty.
Or, it may be actually easy.
Though the superficial use of wx is easy, I may not have understood the event hand ring mechanism of this API yet. An AUI manager, too.
I try after I rest a little.
Thank you.
By the way, Isn't the stub package of Poser released by anyone?
Though I like Eclipse and PyDev, I don't know how to import a poser package outside of Poser.
If that is possible (probably impossible), it is the most desirable.
Only so long as it is necessary, I am making the stub package of Poser unwillingly gradually.
I should use that stub if perfect stub has been already released by someone.
Thread: A multithreading in Poser Python. | Forum: Poser Python Scripting
I noticed that now by your suggestion though I was a little mistaken.
I was mistaken when multithreading of Python in Poser was unacceptable.
A print statement for debugging had been included in the code which worried me.
I should have noticed it when a print statement was used for a last example.
(I may be very tired now by the long programming work.)
The following code actually works in Poser.
#--------------------
import time
import threading
import Queue
class MyThread(threading.Thread):
def init(self, id, aFiFo):
threading.Thread.init(self)
self.id = id
self.queue = aFiFo
self.setDaemon(True)
def run(self):
for i in range(5):
self.queue.put("[%i] %i" % (self.id, i), True)
time.sleep(1)
def main():
queue = Queue.Queue()
thread1 = MyThread(1, queue)
thread2 = MyThread(2, queue)
thread1.start()
thread2.start()
print "Startn"
while True: # the break condition is irresponsible
try:
print queue.get(True, 1)
except Queue.Empty:
break
time.sleep(1)
print "Completed"
main()
#--------------------
I don't have that vigor / reserve power now though I may have to write it a little more in detail.
At any rate, I could probably get a solution.
Thank you.
Thread: A multithreading in Poser Python. | Forum: Poser Python Scripting
Thank you very much for the clear answer.
I understood it.
I must think about another method if those are the specifications of Poser.
Because a so-called parallel computation is not my purpose, I do not care even about imitative thread of Python.
However, I grope for other method, at any rate.
As for me, I wanted to implement the following user interface.
Actually, my Python program which has such a user interface is working suitably outside Poser.
Of course a thread-safe mechanism is made consciously.
At any rate, I must reconsider design fundamentally to work it into Poser.
Thank you again.
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
I am sorry to make it prolonged because my English is poor.
I was afraid that this action might be a cause because it was only the change of the title by post-editing that I carried out before a link died.
A problem didn't happen though I changed the title of another item now.
The cause is something other.
I am sorry to ask it a question for long.
I will report that without deleting an item if I meet with the problem again.
Thank you.
JTrout
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
I wouldn't think it would make a difference, but then again and I don't know.
As for this, I may have misunderstood a little.
Are you wanting to see if you can change the item title (not the the name of the file to be downloaded) without having to re-upload the free item?
As for this, it is Yes.
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Thank you for your quick response.
I don't think as well as you that such a problem is here because the practical use time of this system is long.
I asked it a question because I might trouble many people though I would like to try actually this.
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Probably, my intention has not been introduced to you properly.
Because this system is automated by a server program, a contributor can't change a file name directly.
An access path to the file (such as the URL) is generated automatically from the title of the item and the account name.
As for my being afraid.....
Won't un-consistency in system occur even if the title (It is not a file name.) of the free item is changed by post-editing?
I can't try personally because the influence of this is big.
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Hi,
Thank you for your follow-up.
I don't have a problem after re-uploading at present.
I have a question about the post-editing of an free item.
Is there a problem in changing only the title of FreeItem later?
At this case, When download was unavailable the server error of the kind of "An access key not found." or "inappropriate." was indicated.
I thinks that it occurred after I edit the title of the free item and Note by post-editing.
I can't ascertain that directly.
The above causal relation is unreliable because I noticed download problem later in notification (comment and mail) from other people .
However, as for the detail of HTMLcode of the downloading.....
It seems that an HTML code for downloading in this FreeStuff system takes the influence of the Free Item's title.
At least, the preservation file name in the server side is generated automatically from title and the account name.
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Thank you very much for everyone.
I deleted an item unwillingly because the comment and mail that can not download occurred in many.
I submit it again because it found that there was no problem at least in my Free Item itself.
Thank you again.
JTrout
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Hi,
I am not using my server.
And, uploading to the server of Renderosity is supposed to be successful because a link was available right after I received approved eMail.
I changed the name of FreeItem later, too.
This may have broken the path or the relation to the zip file.
If no inconvenience is in my FreeItem and it is the mere destruction of the link, I have only to delete that item and contribute it again.
But, I only deleted an item now because I couldn't judge that.
By the way, is it suitable to post this kind of question to this forum?
If you know a suitable place of a question, tell me it please.
Kind regards,
JTrout
Thread: Please Help. The link of my freestuff is dead. | Forum: Freestuff
Must I specify a zip file when I edit FreeItem again?
I edited only "Note", and didn't specify a ZIP file again.
Is this a cause?
Thread: wxPython on Macintosh | Forum: Poser Python Scripting
Hi, semidieu
Thank you for your reply.
I tried to check under the "lib.buttons" in accordance with your advice. Then, I found "wx.lib.colourselect.ColourSelect" by chance.
Though it looks like "ColourPickerCtrl", the color of the button changes on Macintosh.
However, still "accept" button and "cancel" button don't appear on the provided Color Picker.
"wx.lib.colourselect.ColourSelect" is useful for me because I would like to make a color select button.
Though the rest is the problem of Color Picker. ・・・・・.
I think that Mac always entails special handling.
No, though of course Mac isn't bad.
Thank you,
JTrout
Thread: Defense from other script | Forum: Poser Python Scripting
Thread: Defense from other script | Forum: Poser Python Scripting
Hi, 3dvice, nruddock.
Thank you for your reply.
I didn't know a "builtin" module.
I saw your reply, and found that at the beginning of "Global Module Index" just now.
My worry was solved.
Thank you very much.
Incidentally, if independence between the script isn't guaranteed......
I think that the use of the global variable in the Python Script of Poser should be restricted.
I think that the wrapper class or the wrapper function to execute user's logic should be prepared.
By the way, which document is "docs for additional info." concretely?
JTrout
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Thread: A multithreading in Poser Python. | Forum: Poser Python Scripting