Ejemplo n.º 1
0
class PlotControl(QtGui.QDialog):
    """ This class controls the custom plot settings """
    def __init__(self,x,y,parent=None):
        #Deafult Init Stuffs:
        QtGui.QDialog.__init__(self,parent)
        self.plotcontrol = Ui_PlotDialog()
        self.plotcontrol.setupUi(self)
        #Rename plot to make life easier
        self.plt = epic.plt
        #Define Varibles:
        self.x = x
        self.y = y
        self.xlabel = ''
        self.ylabel = ''
        self.title = ''
        self.firstrun = True
        #Connect Some stuff:
        conn = QtCore.QObject.connect
        ui = self.plotcontrol
        #Plot Button
        conn(ui.PlotButton, QtCore.SIGNAL("clicked()"), self.ploty)
        #Plot Title
        conn(ui.Title, QtCore.SIGNAL('textChanged(QString)'), self.titley)
        #Plot xlabel
        conn(ui.xLabel, QtCore.SIGNAL('textChanged(QString)'), self.xlabely)
        #Plot ylabel
        conn(ui.yLabel, QtCore.SIGNAL('textChanged(QString)'), self.ylabely)
        
    #Define some functions
    def titley(self,text):
        self.title = str(text)
        
    def xlabely(self,text):
        self.xlabel = str(text)
        
    def ylabely(self,text):
        self.ylabel = str(text)
        
    def ploty(self):
        self.plt.close()
        fig = self.plt.figure()
        ax = fig.add_subplot(111)
        ax.plot(self.x,self.y,'g',linewidth = 0.25)
        ax.xaxis.set_major_formatter(epic.tick.FuncFormatter(epic.axesformatter))
        self.firstrun = False
        self.plt.title(self.title)
        self.plt.xlabel(self.xlabel)
        self.plt.ylabel(self.ylabel)
        self.plt.show()
Ejemplo n.º 2
0
 def __init__(self,x,y,parent=None):
     #Deafult Init Stuffs:
     QtGui.QDialog.__init__(self,parent)
     self.plotcontrol = Ui_PlotDialog()
     self.plotcontrol.setupUi(self)
     #Rename plot to make life easier
     self.plt = epic.plt
     #Define Varibles:
     self.x = x
     self.y = y
     self.xlabel = ''
     self.ylabel = ''
     self.title = ''
     self.firstrun = True
     #Connect Some stuff:
     conn = QtCore.QObject.connect
     ui = self.plotcontrol
     #Plot Button
     conn(ui.PlotButton, QtCore.SIGNAL("clicked()"), self.ploty)
     #Plot Title
     conn(ui.Title, QtCore.SIGNAL('textChanged(QString)'), self.titley)
     #Plot xlabel
     conn(ui.xLabel, QtCore.SIGNAL('textChanged(QString)'), self.xlabely)
     #Plot ylabel
     conn(ui.yLabel, QtCore.SIGNAL('textChanged(QString)'), self.ylabely)