Example #1
0
    def __init__(self):
        QtWidgets.QWidget.__init__(self)

        self.m_DragPosition=self.pos()
        self.avasize=QtWidgets.QDesktopWidget().availableGeometry()#screenGeometry()
        self.setGeometry(self.avasize)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint )
        self.setFocus()
        #self.setCentralWidget(self)
        self.cP=displayWindow(self)
        self.page=[self.cP]
        self.cL=WindowLabel(self,'')
        self.labelbox=[self.cL]
        self.cP.hide()
        self.cL.hide()

        mb=RoundedPushButton(self,100,40,'Zoom')
        print(mb.size())
        #mb.resize(100,40)
        mb.move(100,100)
        #mb.clicked.connect(sc.tootlbar.zoom)

        closeB=ModCloseButton(self,30,30)
        closeB.resize(closeB.size())
        closeB.move(self.width()-30,0)
        #print(cb.geometry())
        
        self.addB= ModCrossButton(self,100,100)
        self.addB.resize(100,100)
        self.addB.move(self.width()/2,self.height()/2)
        self.addB.clicked.connect(self.addNewFigure)
Example #2
0
 def addNewFigure(self):
     print('addB')
     filepath=QtWidgets.QFileDialog.getOpenFileName(self,"Data Load")[0]
     if not filepath.strip() :
         return
     # creat new display window
     self.cP.hide()
     self.page.append( displayWindow(self) )
     self.cP=self.page[-1]
     self.cP.id=len(self.page)-1
     self.cP.move( 0.214*self.width(),  0.214*self.height() )
     
     self.cP.hide()
     print('cp',self.cP.geometry())
     # fig plot
     databox=data_format(filepath)
     sc = FigurePlot(self.cP, width=5, height=4, dpi=100)
     sc.data_load(databox)#[[1,2],[2,3],[3,4]])
     sc.plot_plot()
     sc.resize(self.cP.width()/2,self.cP.height()/2)
     sc.move(self.cP.width()/2-sc.width()/2,self.cP.height()/2-sc.height()/2)
     print('sc',sc.geometry())
     #self.cP.layout.addWidget(sc)
     # fig label set 
     figl=WindowLabel(self, os.path.basename(filepath))
     figl.id=len(self.page)-1
     self.labelbox.append(figl)
     self.cL=self.labelbox[-1]
     if len(self.labelbox) == 1 :
         self.cL.move(0.214*self.width(), 0.214*self.height()-self.height()/60 )
     else :
         self.cL.move(0.214*self.width()+0.1*self.width()*len(self.labelbox), 0.214*self.height()-self.height()/60)
     self.cL.resize(100,30)
     print('windlabel',self.cL.geometry(),self.cL.linelabel.geometry(),self.cL.ltextlabel.geometry())
     # addBotton move
     self.addB.resize( self.cL.height(), self.cL.height() )
     self.addB.move( self.cL.x()+self.cL.width()+5, self.cL.y() )
Example #3
0
class ApplicationWindow(QtWidgets.QWidget):
    def __init__(self):
        QtWidgets.QWidget.__init__(self)

        self.m_DragPosition=self.pos()
        self.avasize=QtWidgets.QDesktopWidget().availableGeometry()#screenGeometry()
        self.setGeometry(self.avasize)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint )
        self.setFocus()
        #self.setCentralWidget(self)
        self.cP=displayWindow(self)
        self.page=[self.cP]
        self.cL=WindowLabel(self,'')
        self.labelbox=[self.cL]
        self.cP.hide()
        self.cL.hide()

        mb=RoundedPushButton(self,100,40,'Zoom')
        print(mb.size())
        #mb.resize(100,40)
        mb.move(100,100)
        #mb.clicked.connect(sc.tootlbar.zoom)

        closeB=ModCloseButton(self,30,30)
        closeB.resize(closeB.size())
        closeB.move(self.width()-30,0)
        #print(cb.geometry())
        
        self.addB= ModCrossButton(self,100,100)
        self.addB.resize(100,100)
        self.addB.move(self.width()/2,self.height()/2)
        self.addB.clicked.connect(self.addNewFigure)
        #addB.clicked.connect(self.close)
        
    def addNewFigure(self):
        print('addB')
        filepath=QtWidgets.QFileDialog.getOpenFileName(self,"Data Load")[0]
        if not filepath.strip() :
            return
        # creat new display window
        self.cP.hide()
        self.page.append( displayWindow(self) )
        self.cP=self.page[-1]
        self.cP.id=len(self.page)-1
        self.cP.move( 0.214*self.width(),  0.214*self.height() )
        
        self.cP.hide()
        print('cp',self.cP.geometry())
        # fig plot
        databox=data_format(filepath)
        sc = FigurePlot(self.cP, width=5, height=4, dpi=100)
        sc.data_load(databox)#[[1,2],[2,3],[3,4]])
        sc.plot_plot()
        sc.resize(self.cP.width()/2,self.cP.height()/2)
        sc.move(self.cP.width()/2-sc.width()/2,self.cP.height()/2-sc.height()/2)
        print('sc',sc.geometry())
        #self.cP.layout.addWidget(sc)
        # fig label set 
        figl=WindowLabel(self, os.path.basename(filepath))
        figl.id=len(self.page)-1
        self.labelbox.append(figl)
        self.cL=self.labelbox[-1]
        if len(self.labelbox) == 1 :
            self.cL.move(0.214*self.width(), 0.214*self.height()-self.height()/60 )
        else :
            self.cL.move(0.214*self.width()+0.1*self.width()*len(self.labelbox), 0.214*self.height()-self.height()/60)
        self.cL.resize(100,30)
        print('windlabel',self.cL.geometry(),self.cL.linelabel.geometry(),self.cL.ltextlabel.geometry())
        # addBotton move
        self.addB.resize( self.cL.height(), self.cL.height() )
        self.addB.move( self.cL.x()+self.cL.width()+5, self.cL.y() )
        # left bar set
        
        
    def displayWindowShow(self,nid):
        self.cP.hide()
        self.cL.statsReset()
        self.cP=self.page[nid]
        self.cP.show()
        self.cL=self.labelbox[self.cP.id]

        # Just some button 
        '''