Пример #1
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.clearButton.clicked.connect(self.clear)
        self.ui.goButton.clicked.connect(self.gocopy)

        self.kbd = PyKeyboard()
Пример #2
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self) 
        
        # move to screen center
        screen = QtGui.QDesktopWidget().screenGeometry()
        windowsize = self.geometry()
        xcenter = (screen.width()  - windowsize.width())/2
        ycenter = (screen.height() - windowsize.height() - windowsize.height())/2
        self.move(xcenter, ycenter)
        
        # Attributes
        self.G = Graph(0, np.zeros((0,0), dtype = np.int32) )   # input graph
        self.p = [] # coordinates of the nodes
        self.pnew = []  # coordinates of the nodes after applying Force-Directed Graph Drawing Algorithm
        self.dist = np.zeros((0,0), dtype = np.int32)   # distance matrix of the graph
        self.step = 0   # iteration step
        
        # constants
        self.paramKK = sparamKK(1,1, 0.0001) # K, L0, eps
        self.paramHK = sparamHK(1, 7, 4, 3, 10) # L, Rad, It, Ratio, Minsize
        self.maxit = 1000
        
        self.k = np.zeros((0,0), dtype = np.int32)
        self.l = np.zeros((0,0), dtype = np.int32)
        
        # Methods        
        # initialise graph
        self.ui.pButton_generateG.clicked.connect(self.pButton_generateG_clicked)
        # run complete algorithm
        self.ui.pbuttonStart.clicked.connect(self.pButtonStart_clicked)
        # make one step of the algorithm
        self.ui.pbuttonStep.clicked.connect(self.pButtonStep_clicked)
        # run till the end from the current position
        self.ui.pbuttonContinue.clicked.connect(self.pButtonContinue_clicked)

        # plot labels
        self.showLabels = True
        self.ui.cBox_ShowLabels.clicked.connect(self.cBox_ShowLabels_clicked)
        # save current graph image
        self.ui.pbuttonSave_InitialG.clicked.connect(self.pButtonSaveImage1_clicked)
        self.ui.pbuttonSave.clicked.connect(self.pButtonSaveImage2_clicked)
    
        # delete result of algorithms 
        self.ui.pbuttonReset.clicked.connect(self.pButtonReset_clicked)     
        
        # hard coded examples
        self.connect(self.ui.actionExample_1, QtCore.SIGNAL('triggered()'), self.startExample_1)
        self.connect(self.ui.actionExample_2, QtCore.SIGNAL('triggered()'), self.startExample_2)
        self.connect(self.ui.actionExample_3, QtCore.SIGNAL('triggered()'), self.startExample_3)  

        self.readFromFile = False
        self.connect(self.ui.action_3eltGraph, QtCore.SIGNAL('triggered()'), self.startExample_3elt)
#        self.connect(self.ui.actionExample_2, QtCore.SIGNAL('triggered()'), self.startExample_2)
#        self.connect(self.ui.actionExample_3, QtCore.SIGNAL('triggered()'), self.startExample_3)  
        
        self.connect(self.ui.action_16x16, QtCore.SIGNAL('triggered()'), self.startExample_grid_16)
        self.connect(self.ui.action_grid32x32, QtCore.SIGNAL('triggered()'), self.startExample_grid_32)
        self.connect(self.ui.action_grid55x55, QtCore.SIGNAL('triggered()'), self.startExample_grid_55)
        
        self.connect(self.ui.action_sgrid16x16, QtCore.SIGNAL('triggered()'), self.startExample_sgrid_16)
        self.connect(self.ui.action_sgrid32x32, QtCore.SIGNAL('triggered()'), self.startExample_sgrid_32)
        self.connect(self.ui.action_sgrid40x40, QtCore.SIGNAL('triggered()'), self.startExample_sgrid_40)
        
        # on parameter changed
        self.ui.textEdit_h.textChanged.connect(self.h_changed)
        self.ui.textEdit_eps.textChanged.connect(self.eps_changed)
        self.ui.textEdit_K.textChanged.connect(self.K_changed)
        self.ui.textEdit_L0.textChanged.connect(self.L0_changed)
        self.ui.textEdit_maxit.textChanged.connect(self.maxit_changed)
        
        self.ui.textEdit_l.textChanged.connect(self.L_changed)
        self.ui.textEdit_radius.textChanged.connect(self.Radius_changed)
        self.ui.textEdit_iterator.textChanged.connect(self.It_changed)
        self.ui.textEdit_ratio.textChanged.connect(self.Ratio_changed)
        self.ui.textEdit_minsize.textChanged.connect(self.Minsize_changed)
        
        # select Algorithm
        self.Alg_KamadaKawai = True
        self.Alg_HarelKoren = False
        self.connect(self.ui.rB_KamadaKawai, QtCore.SIGNAL('toggled(bool)'), self.select_Alg_KamadaKawai)
        self.connect(self.ui.rB_HarelKoren, QtCore.SIGNAL('toggled(bool)'), self.select_Alg_HarelKoren)
Пример #3
0
 def __init__(self):
     super().__init__()
     self.settings = QSettings("Sunline", "sunline-automation")
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.readSettings()