def __init__(self,master,width,height,type,maxundo): BeeSessionState.__init__(self,master,width,height,type) self.commandindexes={} self.historysize=maxundo self.master=master
def __init__(self,master,width=600,height=400,startlayer=True,type=WindowTypes.singleuser,maxundo=40): BeeSessionState.__init__(self,master,width,height,type) qtgui.QWidget.__init__(self) self.localcommandstack=CommandStack(self,CommandStackTypes.singleuser,maxundo=maxundo) self.layerfinisher=LayerFinisher(qtcore.QRectF(0,0,width,height)) # initialize values self.zoom=1.0 self.ui=Ui_DrawingWindowMdi() self.ui.setupUi(self) self.activated=False self.backdrop=None self.filename="" self.cursoroverlay=None self.remotedrawingthread=None self.tooloverlay=None self.selection=None self.selectionlock=qtcore.QReadWriteLock() self.clippath=None self.clippathlock=qtcore.QReadWriteLock() self.localcommandqueue=Queue(0) # replace widget with my custom class widget self.scene=BeeCanvasScene(self) self.ui.PictureViewWidget=BeeCanvasView(self,self.ui.PictureViewWidget,self.scene) self.view=self.ui.PictureViewWidget #self.resizeViewToWindow() self.view.setCursor(master.getCurToolDesc().getCursor()) self.selectiondisplay=SelectedAreaDisplay(None,self.scene,self.view) self.scene.addItem(self.layerfinisher) # initiate drawing thread if type==WindowTypes.standaloneserver: self.localdrawingthread=DrawingThread(self.remotecommandqueue,self.id,type=ThreadTypes.server,master=master) else: self.localdrawingthread=DrawingThread(self.localcommandqueue,self.id,master=self.master) self.localdrawingthread.start() # for sending events to server so they don't slow us down locally self.sendtoserverqueue=None self.sendtoserverthread=None self.serverreadingthread=None # create a backdrop to be put at the bottom of all the layers self.recreateBackdrop() # put in starting blank layer if needed # don't go through the queue for this layer add because we need it to # be done before the next step if startlayer: self.insertLayer(self.nextLayerKey(),0,history=False) # have window get destroyed when it gets a close event self.setAttribute(qtcore.Qt.WA_DeleteOnClose) self.changeWindowTitle("Bee Canvas %d" % self.id) self.setupMenu()