def __init__(self, sysPropsFileName): # create a lock for thread synchronization self.lock = ZMutex(u"ZSystemProperties") #$NON-NLS-1$ self.listeners = ZListenerSet() self.sysPropsFileName = sysPropsFileName self.sysPropsDoc = ZDom() self.reloadProperties()
def __init__(self, parentModel, task, parent): self.parentModel = parentModel self.model = ZBackgroundTaskPanelModel() self.mutex = ZMutex() self.task = task ZTransparentPanel.__init__(self, parent, wx.ID_ANY) self.task.attachListener(self) self._initPanel() self.refresh()
def __init__(self, parent): applicationModel = getApplicationModel() userProfile = applicationModel.getUserProfile() debugFilePath = os.path.join(userProfile.getLogDirectory(), u"ZRavenApplicationStatusBar.log") #$NON-NLS-1$ self.debugFile = open(debugFilePath, u"wa") #$NON-NLS-1$ self._debugMsg(u"== New Debug Session ==") #$NON-NLS-1$ self.progressCtrl = None self.model = ZRavenApplicationStatusBarModel() self.mutex = ZMutex(u"ZAppStatusBarMTX") #$NON-NLS-1$ self._debugMsg(u"Begin Call Super ZStatusBar.__init__") #$NON-NLS-1$ ZStatusBar.__init__(self, parent, self.model.createStatusBarProvider()) self._debugMsg(u"Done Call Super ZStatusBar.__init__") #$NON-NLS-1$ # Attach to any already-running tasks. for task in self.model.getTaskService().getTasks(): if task.isRunning(): self._debugMsg(u"Attaching self as listner to task %s - %s" % (task.getId(), task.getName()) ) #$NON-NLS-1$ task.attachListener(self) # Listen for new tasks that may show up. self._debugMsg(u"Attaching self as listner to task service") #$NON-NLS-1$ self.model.getTaskService().addListener(self) self._debugMsg(u"End ZRavenApplicationStatusBar.__init__") #$NON-NLS-1$
def __init__(self, parent, bgTask, title, description, imagePath): self.title = title self.description = description self.bgTask = bgTask self.imagePath = imagePath # This is here for intellisense purposes. if self.bgTask is None and False: self.bgTask = IZBackgroundTask() self.mutex = ZMutex(u"BGTaskDialogMTX") #$NON-NLS-1$ # Dialog state - can be modified by multiple threads and should # be protected by the above mutex. self.model = ZBackgroundTaskProgressDialogModel() ZHeaderDialog.__init__(self, parent, wx.ID_ANY, title) size = self.GetBestSize() if size.GetWidth() < 500: size.SetWidth(500) self.SetSize(size) self.bgTask.attachListener(self)
def __init__(self): self.mutex = ZMutex(u"ZListenerSetMTX") #$NON-NLS-1$ self.head = None
import random import socket import sys import time # The size of the circular queue. Larger sizes give more assurance for uniqueness. # Smaller sizes take less memory and are a tiny bit faster QUEUE_SIZE = 100 ############################# ### global module variables MAX_RANDOM = sys.maxint # converted to hex goes to 8 chars (at least, in Python 2.3) rand = random.Random() ip = u"" #$NON-NLS-1$ lock = ZMutex(u"guidMTX") #$NON-NLS-1$ lastguid = u"" #$NON-NLS-1$ try: ip = socket.gethostbyname(socket.gethostname()) except ( socket.gaierror ): # if we don't have an ip, default to someting in the 10.x.x.x private range ip = u'10' #$NON-NLS-1$ for i in range(3): ip += u'.' + str(rand.randrange(1, 254)) #$NON-NLS-1$ hexip = u"".join( [u"%04x" % long(i) for i in ip.split(u'.')] ) # leave space for ip v6 (65K in each sub) #$NON-NLS-1$ #$NON-NLS-2$ #$NON-NLS-3$ ####################################### ### A simple circular set
def __init__(self): self.userProfile = None self.dbLock = ZMutex(u"ZPySQLIndexProviderMTX") #$NON-NLS-1$