Exemple #1
0
def runcmd(cmd, msg, recallCL=False):

    if cmd == 'ver':
        import neocl__config as g
        from neocl__funcs import neoAlert
        version = 'neoCL version\n'
        version += g.version + ' ' + g.beta + '\n' + g.date
        mg = 'Tools :\n\n'
        mg += '' + g.GetAllToolsstr(' : ', '\n', True)
        neoAlert(mg, "neoCL", version)
    else:
        from neocl import unknowncmd
        unknowncmd(cmd, recallCL, getcmdlist())
Exemple #2
0
def BackupMyUserFiles(cancelAlert=False):
    mainBakFolder = UserBackupFolder()
    subBakFolder = f.GenerateUniqueDateFolder()
    bakFolder = os.path.join(mainBakFolder, subBakFolder, '')

    if BackupUserFiles(bakFolder):
        f.OpenExplorer(bakFolder)
        mg = "User files backed up to :\n" + str(bakFolder)
    else:
        mg = "Error while backing up user files to to :\n" + str(bakFolder)

    if cancelAlert:
        print(mg)
    else:
        f.neoAlert(mg, 'neoCL', header='Backup User Files', exit=False)
def SaveTable():
    from neocl__funcs import CreateFileInDocFolder, Open_neoCLRevitDocFolder, neoAlert

    cFile = CreateFileInDocFolder(g.savetable, "neoCL.Find.Table.")
    filePath = cFile[0]
    created = cFile[1]

    g.fm.MinimizeMe()

    if created:
        Open_neoCLRevitDocFolder()
        mg = "File saved to:\n" + filePath
        neoAlert(mg, 'neoCL Find', header='Save Table', exit=False)
    else:
        mg = "Could not write file to:\n" + filePath
        neoAlert(mg, 'neoCL Find', header='Save Table', exit=False)

    g.fm.NormalizeMe()
Exemple #4
0
def RestoreBackups():
    WarningMsg = "Warning:\n\nSelect only the files that you really want to keep, " \
       "these files could be updated (new functionalities, fixed errors...).\n\n" \
       "A new backup of the user files will be created before the replace, so if there are " \
       "errors with some tools due an obsolete file, you should restore the newer file!"
    f.neoAlert(WarningMsg,
               'neoCL',
               header='Restore Backed up User Files',
               exit=False)

    from rpw.ui.forms import select_file
    filespath = select_file(GetFilterBackedupFiles(),
                            title='Select backup files to Restore!',
                            multiple=True,
                            restore_directory=True)

    if filespath:
        BackupMyUserFiles(True)  # Backup before replace
        log = ''
        logOk = ''
        logError = ''
        mainFolder = f.neoCLFolderPath()
        files = BackupUserFilesDic(True)
        for src in filespath:
            fileName = os.path.basename(src)
            dst = os.path.join(mainFolder, files[fileName], fileName)
            try:
                copyfile(src, dst)
                logOk += ' -> ' + fileName + '\n'
            except:
                logError += ' -> ' + fileName + '\n'

        if logOk:
            log += "Files restored to neoCL folder :\n" + logOk

        if logError:
            log += "Error restoring these files to neoCL folder :\n" + logError

        log += '\nA new backup of the user files was created before the replace.'
        f.neoAlert(log,
                   'neoCL',
                   header='Restore Backed up User Files',
                   exit=False)
Exemple #5
0
def eEgg_isred(isred, isalwred, FirstRun):
    g.isred = True
    forc = System.Drawing.Color.Red
    bacc = System.Drawing.Color.Black
    g.fm.rColor = bacc
    g.fm.rColorF = forc
    g.fm._comboBoxCmds.BackColor = bacc
    g.fm._comboBoxCmds.ForeColor = forc
    g.fm._listBoxCmds.BackColor = bacc
    g.fm._listBoxCmds.ForeColor = forc
    g.fm._panelBorder.BackColor = forc
    g.fm._labelneoCL.BackColor = bacc
    g.fm._labelneoCL.ForeColor = forc
    if FirstRun:
        g.fm._comboBoxCmds.Text = '?'
        g.fm._listBoxCmds.MaximumSize = System.Drawing.Size(0, 600)
        i.UpdateListBox(False)
        g.fm._comboBoxCmds.Text = '[Easter Egg] All commands in red :'
        if isred:
            neoAlert("Your neoCL is now black/red!\nTo keep it always red type: " + \
                     "myneoclisalwaysred\n(my neoCL is always red)", \
                     title="Easter Egg", header="neoCL")
            g.fm.TopMost = True
        g.fm.nouserinput = True
    if isalwred:
        g.WriteVar('E.EGG', '_isred', True)
        g.fm._comboBoxCmds.Text = '?'
        i.UpdateListBox(False)
        g.fm._comboBoxCmds.Text = 'To revert : myneoclisnotalwaysred'
        g.fm.nouserinput = False
        neoAlert("Your neoCL is now always black/red!\nTo revert it remember to type: " + \
                 "myneoclisnotalwaysred\n(my neoCL is not always red)", \
                 title="Easter Egg", header="neoCL")
        g.fm.TopMost = True


#def Processcmds():
#    p = 1
#    for k, v in g.allcmds.items():
#        cmd(str(k), str(v), p)
#        p += 1

#def FillComboBox():
#	for k, v in g.allcmds.items():
#		g.fm._comboBoxCmds.Items.Add(str(k))

#def FillListBox():
#	for k, v in g.allcmds.items():
#		g.fm._listBoxCmds.Items.Add('[' + str(k) + ']\t' + str(v))

#class cmd:
#
#    def __init__(self, k, v, p):
#        self.k = k
#        self.v = v
#        self.p = p
#        self.dic = {k : v}
#        self.AddMeToComboBox()
#        self.AddMeToListBox()
#        self.AddMeToActivecmds()
#
#    def AddMeToComboBox(self):
#        g.fm._comboBoxCmds.Items.Add(str(self.k))
#
#    def AddMeToListBox(self):
#        g.fm._listBoxCmds.Items.Add('[' + str(self.k) + ']\t' + str(self.v))
#
#    def AddMeToAllcmdslist(self):
#        g.allcmdslist.append(self)
#
#    def RemoveMeFromComboBox(self):
# not compatible usabel
# listbox is updated to user input
# but combobox has allways all commands
# so diferent positions
#        g.fm._comboBoxCmds.Items.RemoveAt(self.p)
#g.fm.Update()

#    def RemoveMeFromListBox(self):
#        g.fm._listBoxCmds.Items.RemoveAt(self.p)
#g.fm.Update()

#    def RemoveMeFromAllcmdslist(self):
#        g.allcmdslist.remove(self)
#g.fm.Update()

#    def killme(self):
#        RemoveMeFromComboBox()
#        RemoveMeFromListBox()
#        RemoveMeFromActivecmds()
#       del self