Пример #1
0
 def experimentAddDialog(self, parent, existingconfignames):
     logging.debug("experimentAddDialog(): Instantiated")
     self.parent = parent
     self.s = SystemConfigIO()
     self.destinationPath = os.path.join(
         self.s.getConfig()['EXPERIMENTS']['EXPERIMENTS_PATH'])
     self.configname, ok = QInputDialog.getText(
         parent, 'Experiment',
         'Enter new experiment name \r\n(non alphanumeric characters will be removed)'
     )
     if ok:
         #standardize and remove invalid characters
         self.configname = ''.join(e for e in self.configname
                                   if e.isalnum())
         #check to make sure the name doesn't already exist
         if self.configname in existingconfignames:
             QMessageBox.warning(
                 self.parent, "Name Exists",
                 "The experiment name specified already exists",
                 QMessageBox.Ok)
             return None
         ##Otherwise, create the folders for this and return the name so that it can be added to the main GUI window
         successfilenames = self.addExperiment()
         logging.debug("experimentAddDialog(): Completed")
         if len(successfilenames) > 0:
             return self.configname
     return None
Пример #2
0
    def __init__(self, parent, configname, actionname, experimentHostname, rdpBrokerHostname="<unspecified>", users_file="", itype="", name=""):
        logging.debug("ConnectionActionDialog(): instantiated")
        super(ConnectionActionDialog, self).__init__(parent)
        self.parent = parent
        self.eco = ExperimentConfigIO.getInstance()
        self.s = SystemConfigIO()
        self.configname = configname
        self.actionname = actionname
        self.experimentHostname = experimentHostname
        self.usersFile = users_file
        self.itype = itype
        self.name = name
        if rdpBrokerHostname.strip() == "":
            self.rdpBrokerHostname = "<unspecified>"
            self.setEnabled(False)
        else:
            self.rdpBrokerHostname = rdpBrokerHostname
        self.cm = ConnectionManage()
        self.setMinimumWidth(450)

        self.createFormGroupBox()
        
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.formGroupBox)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
        
        self.setWindowTitle(str(actionname) + " Connection")
Пример #3
0
 def hypervisorOpenDialog(self, parent):
     logging.debug("hypervisorOpenDialog(): Instantiated")
     self.parent = parent
     self.s = SystemConfigIO()
     result = self.openHypervisor(self.s.getConfig()["VBOX"]["VBOX_PATH"])
     logging.debug("hypervisorOpenDialog(): Completed")
     return result
Пример #4
0
 def experimentActionDialog(self, configname, actionname, itype="", name=""):
     logging.debug("experimentActionDialog(): Instantiated")
     self.configname = configname
     self.s = SystemConfigIO()
     self.destinationPath = os.path.join(self.s.getConfig()['EXPERIMENTS']['EXPERIMENTS_PATH'])
     ouputstr = self.experimentAction(actionname, itype, name)
     logging.debug("experimentActionDialog(): Completed")
     return ouputstr
Пример #5
0
    def __init__(self, vmManage, experimentManage):
        logging.debug("PackageManageVBox(): instantiated")
        PackageManage.__init__(self)

        self.vmManage = vmManage
        self.em = experimentManage
        self.s = SystemConfigIO()
        self.s.readConfig()
Пример #6
0
 def materialRemoveFileDialog(self, configname, materialname):
     logging.debug("materialRemoveFileDialog(): Instantiated")
     self.configname = configname
     self.materialname = materialname
     self.s = SystemConfigIO()
     self.destinationPath = os.path.join(
         self.s.getConfig()['EXPERIMENTS']['EXPERIMENTS_PATH'],
         self.configname, "Materials")
     successfilenames = self.removeMaterial(materialname)
     logging.debug("materialRemoveFileDialog(): Completed")
     return successfilenames
Пример #7
0
    def __init__(self, parent):
        logging.debug("VMRetrieveDialog(): instantiated")
        super(VMRetrieveDialog, self).__init__(parent)
        self.parent = parent
        self.s = SystemConfigIO()
        self.vms = {}
        self.vmNames = []

        self.buttons = QDialogButtonBox()
        self.ok_button = self.buttons.addButton(self.buttons.Ok)
        self.ok_button.setEnabled(False)
        self.buttons.addButton(self.buttons.Cancel)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.setWindowTitle("Add Virtual Machines")
        #self.setFixedSize(550, 300)

        self.box_main_layout = QGridLayout()
        self.box_main = QWidget()
        self.box_main.setLayout(self.box_main_layout)

        label = QLabel("Select VMs to add")
        self.box_main_layout.addWidget(label, 1, 0)

        self.setLayout(self.box_main_layout)

        #####
        # Here we will place the tree view
        self.treeWidget = VMTreeWidget(self)
        self.treeWidget.itemSelectionChanged.connect(self.onItemSelected)

        self.box_main_layout.addWidget(self.treeWidget, 1, 0)

        s = VMRetrievingDialog(self.parent).exec_()
        self.vms = s["vmstatus"]

        if len(self.vms) == 0:
            logging.error("No VMs were retrieved")
            noVMsDialog = QMessageBox.critical(
                self, "VM Error",
                "No VMs were found. If you think this is incorrect, please check the path to VBoxManage in config/config.ini and then restart the program.",
                QMessageBox.Ok)

        #self.treeWidget.setSelectionMode(VMTreeWidget.MultiSelection)
        self.treeWidget.populateTreeStore(self.vms)
        #self.treeWidget.adjustSize()
        #self.adjustSize()

        #####
        self.box_main_layout.addWidget(self.buttons, 2, 0)

        self.setLayout(self.box_main_layout)
Пример #8
0
 def __init__(self, initializeVMManage=True):
     logging.info("VBoxManage.__init__(): instantiated")
     VMManage.__init__(self)
     self.cf = SystemConfigIO()
     self.vmanage_path = self.cf.getConfig()['VBOX']['VMANAGE_PATH']
     # A lock for acces/updates to self.vms
     self.lock = RLock()
     self.vms = {}
     self.tempVMs = {}
     if initializeVMManage:
         self.refreshAllVMInfo()
         result = self.getManagerStatus()["writeStatus"]
         while result != self.MANAGER_IDLE:
             #waiting for manager to finish query...
             result = self.getManagerStatus()["writeStatus"]
             time.sleep(.1)
Пример #9
0
 def materialAddFileDialog(self, configname):
     logging.debug("materialAddFileDialog(): Instantiated")
     self.configname = configname
     self.s = SystemConfigIO()
     self.destinationPath = os.path.join(
         self.s.getConfig()['EXPERIMENTS']['EXPERIMENTS_PATH'],
         self.configname, "Materials")
     widget = QFileDialog()
     filenames = ""
     filenames, _ = QFileDialog.getOpenFileNames(widget, "Choose Material",
                                                 "")
     if len(filenames) > 1:
         successfilenames = self.copyMaterial(filenames)
         return successfilenames
     elif len(filenames) == 1:
         successfilenames = self.copyMaterial(filenames)
         return successfilenames
     else:
         return []
     logging.debug("materialAddFileDialog(): Completed")
Пример #10
0
    def __init__(self, parent):
        logging.debug("ConfigurationDialog(): instantiated")
        super(ConfigurationDialog, self).__init__(parent)
        self.parent = parent
        self.s = SystemConfigIO()
        self.setMinimumWidth(435)

        self.createFormGroupBox()

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.formGroupBox)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("RES Configuration")
Пример #11
0
 def __init__(self):
     #Virtually private constructor
     self.s = SystemConfigIO()
     self.rolledoutjson = {}
     self.config_jsondata = {}
     self.config_rdp_userpass = {}
Пример #12
0
    def __init__(self, parent=None):
        logging.debug("MainApp:init() instantiated")
        super().__init__()
        self.baseWidgets = {}
        self.vmWidgets = {}
        self.materialWidgets = {}
        self.cf = SystemConfigIO()
        self.ec = ExperimentConfigIO.getInstance()
        self.statusBar = QStatusBar()

        self.setMinimumSize(670, 565)
        quit = QAction("Quit", self)
        quit.triggered.connect(self.closeEvent)
        self.setWindowTitle("ARL South RES v0.1")

        self.tabWidget = QtWidgets.QTabWidget()
        self.tabWidget.setGeometry(QtCore.QRect(0, 15, 668, 565))
        self.tabWidget.setObjectName("tabWidget")

        # Configuration Window (windowBox) contains:
        ## windowBoxHLayout contains:
        ###experimentTree (Left)
        ###basedataStackedWidget (Right)
        self.windowWidget = QtWidgets.QWidget()
        self.windowWidget.setObjectName("windowWidget")
        self.windowBoxHLayout = QtWidgets.QHBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxHLayout.setObjectName("windowBoxHLayout")
        self.windowWidget.setLayout(self.windowBoxHLayout)

        self.experimentTree = QtWidgets.QTreeWidget()
        self.experimentTree.itemSelectionChanged.connect(self.onItemSelected)
        self.experimentTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.experimentTree.customContextMenuRequested.connect(
            self.showContextMenu)
        self.experimentTree.setEnabled(True)
        self.experimentTree.setMinimumSize(200, 521)
        self.experimentTree.setMaximumWidth(350)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.headerItem().setText(0, "Experiments")
        self.experimentTree.setSortingEnabled(False)
        self.windowBoxHLayout.addWidget(self.experimentTree)

        self.basedataStackedWidget = QStackedWidget()
        self.basedataStackedWidget.setObjectName("basedataStackedWidget")
        self.basedataStackedWidget.setEnabled(False)
        self.windowBoxHLayout.addWidget(self.basedataStackedWidget)
        self.tabWidget.addTab(self.windowWidget, "Configuration")

        # VBox Actions Tab
        self.experimentActionsWidget = ExperimentActionsWidget(
            statusBar=self.statusBar)
        self.experimentActionsWidget.setObjectName("experimentActionsWidget")
        self.tabWidget.addTab(self.experimentActionsWidget,
                              "Experiment Actions")

        # Remote Connections Tab
        self.connectionWidget = ConnectionWidget(statusBar=self.statusBar)
        self.connectionWidget.setObjectName("connectionsWidget")
        self.tabWidget.addTab(self.connectionWidget, "Remote Connections")

        #Create the bottom layout so that we can access the status bar
        self.bottomLayout = QHBoxLayout()
        self.statusBar.showMessage("Loading GUI...")
        self.bottomLayout.addWidget(self.statusBar)
        self.saveButton = QtWidgets.QPushButton("Save Current")
        self.saveButton.clicked.connect(self.saveExperimentButton)
        self.saveButton.setEnabled(False)
        self.bottomLayout.addWidget(self.saveButton)

        self.populateUi()
        self.setupContextMenus()

        self.initMenu()
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.mainMenu)
        self.mainLayout.addWidget(self.tabWidget)
        self.mainLayout.addLayout(self.bottomLayout)

        self.setLayout(self.mainLayout)
        #self.setCentralWidget(self.outerBox)
        self.tabWidget.setCurrentIndex(0)

        #self.statusBar.showMessage("Finished Loading GUI Components")

        # Plugin Section
        self.tabWidget.addTab(CTFi2GUI(), "CTFi2")