Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        super(FarmDB_MainWindow, self).__init__(*args, **kwargs)
        self.ui = ui_Main.Ui_MainWindow()
        self.ui.setupUi(self)

        # Resolve mongodb collection
        collection = Task.get_mongodb_collection()

        # Replace the default TableView for the Jobs by our own Implementation
        layout = self.ui.tableView_Jobs.parent().layout()
        self.ui.tableView_Jobs.deleteLater()
        self.ui.tableView_Jobs = TableViewJobs(collection=collection)
        layout.addWidget(self.ui.tableView_Jobs)

        self.ui.tableView_Jobs.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)

        '''
        # Replace the default TableView for the Slaves by our own Implementation
        layout = self.ui.tableView_Jobs.parent().layout()
        self.ui.tableView_Slaves.deleteLater()
        self.ui.tableView_Slaves = MongoBrowser.CustomTableView_Editable(collection=Slave._get_mongodb_collection())
        layout.addWidget(self.ui.tableView_Slaves)
        '''

        self.ui.actionCreateJob.triggered.connect(self.on_create_job)
        self.ui.actionDeleteJob.triggered.connect(self.on_delete_job)
        self.ui.actionStartJob.triggered.connect(self.on_start_job)
        self.ui.actionStopJob.triggered.connect(self.on_stop_job)
Esempio n. 2
0
 def on_create_job(self):
     job = Task.insert_one(name="yoyoyo")
     self.update_tasks()
     print(Task.find())