コード例 #1
0
ファイル: super_menu.py プロジェクト: echads/emubox
    def deleteClonesActionEvent(self, menuItem):
        logging.debug("deleteClonesActionEvent() initiated: " + str(menuItem))
        if self.session.currentWorkshop is None:
            WarningDialog(
                self.window,
                "You must select a workshop before you can delete clones.")
            return
        elif getStatus(
                self.session.currentWorkshop.filename) == "Clones Not Created":
            WarningDialog(Gtk.Window(),
                          "Clones are not yet created for this workshop.")
            return
        elif getStatus(self.session.currentWorkshop.filename) == "Running":
            WarningDialog(
                self.window,
                "Workshop is currently running. Cannot delete running clones.")
        elif getStatus(self.session.currentWorkshop.filename) == "Ready":
            workshopName = self.session.currentWorkshop.filename
            clones = getCloneNames(workshopName)

            for clone in clones:
                logging.debug(
                    "deleteClonesActionEvent(): instantiating ProcessDialog")
                pd = ProcessDialog(VBOXMANAGE_DIRECTORY + " unregistervm " +
                                   clone.replace(" ", "\\ ") + " --delete")
                logging.debug(
                    "deleteClonesActionEvent(): running ProcessDialog")
                pd.run()
                pd.destroy()
                logging.debug(
                    "deleteClonesActionEvent(): returned from ProcessDialog")
            self.refreshActionEvent(self.session.workshopList)
コード例 #2
0
ファイル: super_menu.py プロジェクト: echads/emubox
    def cloneWorkshopActionEvent(self, menuItem):
        logging.debug("cloneWorkshopActionEvent() initiated: " + str(menuItem))
        if self.session.currentWorkshop is None:
            WarningDialog(
                Gtk.Window(),
                "You must select a workshop before you can run the workshop.")
            return
        elif getStatus(
                self.session.currentWorkshop.filename) != "Clones Not Created":
            WarningDialog(Gtk.Window(),
                          "Clones are already created for this workshop.")
            return

        workshopName = self.session.currentWorkshop.filename
        command = "python -u \"" + WORKSHOP_CREATOR_FILE_PATH + "\" \"" + os.path.join(
            WORKSHOP_CONFIG_DIRECTORY, workshopName + ".xml\"")
        logging.debug(
            "cloneWorkshopActionEvent(): instantiating ProcessDialog with command: "
            + command)
        pd = ProcessDialog(command)
        logging.debug("cloneWorkshopActionEvent(): running ProcessDialog")
        pd.run()
        pd.destroy()
        logging.debug(
            "cloneWorkshopActionEvent(): returned from ProcessDialog")
        self.session.overwriteAllToSaveDirectory()
        self.refreshActionEvent(self.session.workshopList)
コード例 #3
0
ファイル: super_menu.py プロジェクト: echads/emubox
    def startVMsActionEvent(self, menuItem):
        logging.debug("startVMsActionEventActionEvent() initiated: " +
                      str(menuItem))
        if self.session.currentWorkshop is None:
            WarningDialog(
                Gtk.Window(),
                "You must select a workshop before you can run the workshop.")
            return

        elif getStatus(
                self.session.currentWorkshop.filename) == "Clones Not Created":
            WarningDialog(Gtk.Window(), "Clones are not yet created.")
            return

        elif getStatus(self.session.currentWorkshop.filename) == "Running":
            WarningDialog(Gtk.Window(), "Workshop is already running.")
            return

        workshopName = self.session.currentWorkshop.filename
        command = "python -u \"" + VM_STARTER_FILE_PATH + "\" \"" + os.path.join(
            WORKSHOP_CONFIG_DIRECTORY, workshopName + ".xml\"")
        logging.debug("startVMsActionEvent(): instantiating ProcessDialog")
        pd = ProcessDialog(command)
        logging.debug("startVMsActionEvent(): running ProcessDialog")
        pd.run()
        pd.destroy()
        logging.debug("startVMsActionEvent(): returned from ProcessDialog")
        self.refreshActionEvent(self.session.workshopList)
コード例 #4
0
    def download(self, menuItem):
        logging.debug("beginning new workshop download")
        if (self.downloadIndex == None):
            if not self.getDownloadIndex(None):
                return
        downloadDialog = DownloadDialog(self, "Select a workshop to download.",
                                        self.downloadIndex)
        downloadText = None

        while not downloadDialog.status:
            if downloadDialog.status is False:
                downloadDialog.destroy()
                return
            downloadDialog.run()
            downloadText = downloadDialog.xmlString
        downloadDialog.destroy()

        if downloadText is None:
            return
        elif self.session.isWorkshop(downloadDialog.entryText):
            WarningDialog(self, "Workshop already exists.")
            return

        if not self.downloadFile(
                self.session.getDownloadLink(downloadText,
                                             downloadDialog.entryText),
                downloadDialog.entryText):
            return

        zipPath = str(self.session.downloadedZip)
        if not os.path.isfile(zipPath):
            WarningDialog(self, "Error Downloading File, please retry")
            return

        # First we need to unzip the import file to a temp folder
        spinnerDialog = SpinnerDialog(self, "Preparing to unzip files")
        self.session.unzip(zipPath, spinnerDialog)
        spinnerDialog.destroy()

        spinnerDialog = SpinnerDialog(self, "Preparing to import files")
        self.session.importParseWithSpinner(
            os.path.join(WORKSHOP_TMP_DIRECTORY, downloadDialog.entryText),
            spinnerDialog)
        spinnerDialog.destroy()

        # # reload all xml files and create a new display
        self.workshopTree.clearTreeStore()
        self.session.loadXMLFiles(WORKSHOP_CONFIG_DIRECTORY)
        self.workshopTree.populateTreeStore(self.session.workshopList)
        shutil.rmtree(WORKSHOP_TMP_DIRECTORY, ignore_errors=True)
        os.remove(zipPath)
        dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO,
                                   Gtk.ButtonsType.OK,
                                   "Workshop download complete.")
        dialog.run()
        dialog.destroy()
        self.superMenu.refreshActionEvent(self.session.workshopList)
コード例 #5
0
ファイル: AppWindow.py プロジェクト: susereum/FinalSunday9
 def downloadFile(self, url, workshopName):
     logging.debug("initiating download with progress spinner dialog")
     try:
         spinnerDialog = SpinnerDialog(self, "Preparing to download workshop...")
         self.session.downloadWorkshop(url, workshopName, spinnerDialog)
         spinnerDialog.destroy()
         return True
     except:
         WarningDialog(self, "Could not download workshop file.  Check your network connection.")
         return False
コード例 #6
0
ファイル: AppWindow.py プロジェクト: susereum/FinalSunday9
 def getDownloadIndex(self, location):
     logging.debug("Attempt to download index file")
     if location == None:
         location = ONLINE_INDEX_FILE
     try:
         self.downloadIndex = urllib2.urlopen(location).read()
         return True
     except:
         WarningDialog(self, "Could not fetch workshop index file.  Check your network connection and the location.")
         return False
コード例 #7
0
ファイル: AppWindow.py プロジェクト: susereum/FinalSunday9
    def poweroffVMsActionEvent(self, menuItem):
        logging.debug("poweroffVMsActionEvent() initiated: " + str(menuItem))
        if self.session.currentWorkshop is None:
            WarningDialog(self.window, "You must select a workshop before you can run the workshop.")
            return

        workshopName = self.session.currentWorkshop.filename
        command = "python -u \"" + VM_POWEROFF_FILE_PATH + "\" \"" + os.path.join(WORKSHOP_CONFIG_DIRECTORY,
                                                                                  workshopName + ".xml\"")
        logging.debug("poweroffVMsActionEvent(): instantiating ProcessDialog")
        pd = ProcessDialog(command)
        logging.debug("poweroffVMsActionEvent(): running ProcessDialog")
        pd.run()
        pd.destroy()
        logging.debug("poweroffVMsActionEvent(): returned from ProcessDialog")
コード例 #8
0
ファイル: AppWindow.py プロジェクト: susereum/FinalSunday9
    def removeInetEventHandler(self, menuItem, *data):
        logging.debug("removeInetEventHandler() initiated: " + str(menuItem) + " " + str(data))

        if len(self.vmWidget.inetBasenameWidgetList) > 1:
            self.vmWidget.removeInet(data[0])

            # Adjust button handlers for remaining inets
            i = data[0]
            for inet in self.vmWidget.inetBasenameWidgetList[i:]:
                inet.removeInetButton.handler_disconnect(inet.removeInetButtonHandlerID)
                inet.removeInetButtonHandlerID = inet.removeInetButton.connect("clicked", self.removeInetEventHandler, i)
                i += 1
            self.actionBox.show_all()

        else:
            WarningDialog(self, "There must be at least one Internalnet Basename.")
            return
コード例 #9
0
ファイル: super_menu.py プロジェクト: echads/emubox
    def poweroffVMsActionEvent(self, menuItem):
        logging.debug("poweroffVMsActionEvent() initiated: " + str(menuItem))
        if self.session.currentWorkshop is None:
            WarningDialog(
                self.window,
                "You must select a workshop before you can run the workshop.")
            return
        #TODO: will uncomment when we code a way to see if VM running in windows
        #elif getStatus(self.session.currentWorkshop.filename) != "Running":
        #    WarningDialog(Gtk.Window(),  "Workshop is not running")
        #    return

        workshopName = self.session.currentWorkshop.filename
        command = "python -u \"" + VM_POWEROFF_FILE_PATH + "\" \"" + os.path.join(
            WORKSHOP_CONFIG_DIRECTORY, workshopName + ".xml\"")
        logging.debug("poweroffVMsActionEvent(): instantiating ProcessDialog")
        pd = ProcessDialog(command)
        logging.debug("poweroffVMsActionEvent(): running ProcessDialog")
        pd.run()
        pd.destroy()
        logging.debug("poweroffVMsActionEvent(): returned from ProcessDialog")
        self.refreshActionEvent(self.session.workshopList)