def getAERenderOnlyFileName(self):
        # Get the path to the text file that forces After Effects to run in Render Engine mode.
        outputPath = os.path.join(
            Environment.GetFolderPath(Environment.SpecialFolder.Personal),
            "ae_render_only_node.txt")
        if SystemUtils.IsRunningOnMac():
            outputPath = os.path.join(
                Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                "Documents/ae_render_only_node.txt")

        return outputPath
예제 #2
0
    def __initialize(cls):

        # get the basic locations that the other locations build on
        script_dir = Directory.GetParent(__file__).FullName
        profile_dir = Environment.GetFolderPath(
           Environment.SpecialFolder.ApplicationData) + \
           r"\Comic Vine Scraper"

        # set the standard locations for settings files
        cls.SETTINGS_FILE = profile_dir + r'\settings.dat'
        cls.ADVANCED_FILE = profile_dir + r'\advanced.dat'
        cls.GEOMETRY_FILE = profile_dir + r'\geometry.dat'
        cls.SERIES_FILE = profile_dir + r'\series.dat'
        cls.LOCAL_CACHE_DIRECTORY = profile_dir + r'\localCache'
        cls.I18N_DEFAULTS_FILE = script_dir + r"\en.zip"

        # do a special trick to things run from within the IDE,
        # where certain files like 'en.zip' are in different locations
        ide_i18n_file = Directory.GetParent(
           Directory.GetParent( script_dir).FullName ).FullName + \
           r'\src\resources\languages\en.zip'
        if not File.Exists(cls.I18N_DEFAULTS_FILE) \
              and File.Exists( ide_i18n_file ):
            cls.I18N_DEFAULTS_FILE = ide_i18n_file

        # import settings from legacy location, if needed.
        # ensure profile directory exists.
        cls.__import_legacy_settings(script_dir, profile_dir)
        if not File.Exists(profile_dir):
            Directory.CreateDirectory(profile_dir)
예제 #3
0
def HandleExportHeatSource(sender, args):
    NewFileLocation = r"C:\Users"

    dialog = SaveFileDialog()
    dialog.Title = "Export heat source"

    dialog.FileName = "{0}mm_{1}cm-min.xml".format(
        beadSizeInput.Text.replace('.', ','),
        travelSpeedInput.Text.replace('.', ','))
    dialog.Filter = "XML Files|*.xml"
    dialog.InitialDirectory = Environment.GetFolderPath(
        Environment.SpecialFolder.MyDocuments)

    if dialog.ShowDialog():
        NewFileLocation = dialog.FileName
        file_path = os.path.dirname(os.path.realpath(__file__))
        HeatSourceFile = os.path.join(file_path, 'Heat-source_Power.xml')

        RequiredPower, _ = ReqPowerText.Text.split(' kJ')
        FrontLength, _ = FLEstimate.Text.split(' mm')
        RearLength, _ = RLEstimate.Text.split(' mm')
        WidthLength, _ = WidthEstimate.Text.split(' mm')
        DepthLength, _ = DepthEstimate.Text.split(' mm')

        with open(NewFileLocation, 'w') as NewHeatSource:
            with open(HeatSourceFile, 'r') as Template:
                for line in Template:
                    if "<comment>" in line:
                        line = "<comment>{0}</comment>".format(
                            "Generated by MSC Apex welding toolkit")
                    if "<velocity dimension=" in line:
                        line = '<velocity dimension="7" unit="8">{0}</velocity>'.format(
                            travelSpeedInput.Text)
                    if "<power dimension=" in line:
                        line = '<power dimension="12" unit="0">{0}</power>'.format(
                            RequiredPower)
                    if "<efficiency>" in line:
                        line = '<efficiency>{0}</efficiency>'.format(
                            effParamInput.Text)
                    if "<front_length" in line:
                        line = '<front_length dimension="5" unit="2" value="{0}"/>'.format(
                            FrontLength)
                    if '<rear_length' in line:
                        line = '<rear_length dimension="5" unit="2" value="{0}"/>'.format(
                            RearLength)
                    if '<width dimension' in line:
                        line = '<width dimension="5" unit="2" value="{0}"/>'.format(
                            WidthLength)
                    if '<depth dimension' in line:
                        line = '<depth dimension="5" unit="2" value="{0}"/>'.format(
                            DepthLength)
                    NewHeatSource.write(line)
예제 #4
0
def OpenAndActivateBatchRvtTemporaryDocument(uiApplication):
    application = uiApplication.Application
    BATCHRVT_TEMPORARY_REVIT_FILE_PATH = Path.Combine(
        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
        "BatchRvt", "TemporaryProject." + application.VersionNumber + ".rvt")
    if not path_util.FileExists(BATCHRVT_TEMPORARY_REVIT_FILE_PATH):
        path_util.CreateDirectoryForFilePath(
            BATCHRVT_TEMPORARY_REVIT_FILE_PATH)
        newDoc = CreateNewProjectFile(application,
                                      BATCHRVT_TEMPORARY_REVIT_FILE_PATH)
        newDoc.Close(False)
    uiDoc = uiApplication.OpenAndActivateDocument(
        BATCHRVT_TEMPORARY_REVIT_FILE_PATH)
    return uiDoc
예제 #5
0
def HandleExportHeatSource(sender, args):
    NewFileLocation = r"C:\Users"

    dialog = SaveFileDialog()
    dialog.Title = "Export heat source"

    dialog.FileName = "{0}cm-min_{1}A_{2}V.xml".format(travelSpeedInput.Text,
                                                       elecCurrentInput.Text,
                                                       elecVoltageInput.Text)
    dialog.Filter = "XML Files|*.xml"
    dialog.InitialDirectory = Environment.GetFolderPath(
        Environment.SpecialFolder.MyDocuments)

    if dialog.ShowDialog():
        NewFileLocation = dialog.FileName
        file_path = os.path.dirname(os.path.realpath(__file__))
        HeatSourceFile = os.path.join(file_path, 'Heat-source.xml')
        with open(NewFileLocation, 'w') as NewHeatSource:
            with open(HeatSourceFile, 'r') as Template:
                for line in Template:
                    if "<comment>" in line:
                        line = "<comment>{0}</comment>".format(
                            "Generated by MSC Apex welding toolkit")
                    if "<velocity dimension=" in line:
                        line = '<velocity dimension="7" unit="8">{0}</velocity>'.format(
                            travelSpeedInput.Text)
                    if "<voltage dimension=" in line:
                        line = '<voltage dimension="20" unit="0">{0}</voltage>'.format(
                            elecVoltageInput.Text)
                    if "<current dimension=" in line:
                        line = '<current dimension="2" unit="0">{0}</current>'.format(
                            elecCurrentInput.Text)
                    if "<efficiency>" in line:
                        line = '<efficiency>{0}</efficiency>'.format(
                            effParamInput.Text)
                    if "<front_length" in line:
                        line = '<front_length dimension="5" unit="2" value="{0}"/>'.format(
                            FLEstimate.Text)
                    if '<rear_length' in line:
                        line = '<rear_length dimension="5" unit="2" value="{0}"/>'.format(
                            RLEstimate.Text)
                    if '<width dimension' in line:
                        line = '<width dimension="5" unit="2" value="{0}"/>'.format(
                            WidthEstimate.Text)
                    if '<depth dimension' in line:
                        line = '<depth dimension="5" unit="2" value="{0}"/>'.format(
                            DepthEstimate.Text)
                    NewHeatSource.write(line)
예제 #6
0
파일: exportIFC.py 프로젝트: karthi1015/bim
def exportNWD(filePath, expPath, viewName):
    err = checkInput(filePath)
    if err:
        return ("Invalid path")
    app = DocMgr.Instance.CurrentUIApplication.Application
    modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath)
    openOpts = OpenOptions()
    wsConfig = WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets)
    openOpts.SetOpenWorksetsConfiguration(wsConfig)
    doc = app.OpenDocumentFile(modelPath, openOpts)
    expView = findNwdView(doc, viewName)
    expOpts = setupExpOptions(expView)
    if expPath == None:
        expPath = Environment.GetFolderPath(
            Environment.SpecialFolder.MyDocuments)
    doc.Export(expPath, String.Empty, expOpts)
    doc.Close(False)
    return (filePath)
예제 #7
0
def loadMasterPluginIndex():
    """ Loads the Master Plugin Index List into a map
	"""
    import System
    from System.IO import Path
    from System import Environment
    file = Path.Combine(
        Environment.GetFolderPath(
            Environment.SpecialFolder.LocalApplicationData), 'Skyrim',
        'plugins.txt')
    with open(file, "rt") as f:
        first = f.readline().strip().lower()
        offset = first != 'skyrim.esm' and 1 or 0
        masterIdx = dict([(r.strip().lower(), i + offset)
                          for i, r in enumerate(f.readlines())])
        masterIdx[first] = offset
        if offset: masterIdx['skyrim.esm'] = 0
    return masterIdx
예제 #8
0
def try_get_plugin_path(plugin):
    """Try to get path to plugin folder."""
    clr.AddReference('ProtoGeometry')
    _loc = tuple(a.Location
                 for a in AppDomain.CurrentDomain.GetAssemblies()
                 if 'ProtoGeometry' in a.FullName)

    try:
        _ver = float(_loc[0].split('\\')[-2])
    except:
        _ver = float(_loc[0].split('\\')[-2].split(' ')[-1])

    assert _ver >= 1.2, 'You need Dynamo 1.2 or higher to use this plugin!'

    _appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
    _dynamo_path = '\\'.join(_loc[0].split('\\')[-4:-1])
    # if the assembly is cached put Revit folder first, and then try to load it from core
    _dynamo_paths = (_dynamo_path.replace('Dynamo Core', 'Dynamo Revit'),
                    _dynamo_path.replace('Dynamo Revit', 'Dynamo Core'))
    _settings_filename = 'DynamoSettings.xml'

    pkf = []
    for path in _dynamo_paths:
        settings_file = IO.Path.Combine(_appdata, path, _settings_filename)
        if IO.File.Exists(settings_file):
            with open(settings_file, 'rb') as outf:
                for line in outf:
                    if line.strip().startswith('<CustomPackageFolders>'):
                        for l in outf:
                            if l.strip().startswith('</CustomPackageFolders>'):
                                break
                            else:
                                pkf.append(l.replace('</string>', '').replace('<string>', '').strip())

    for p in pkf:
        pp = IO.Path.Combine(p, 'packages', plugin, 'extra')
        # In case of custom folders user may put honeybee under the root folder
        ppp = IO.Path.Combine(p, plugin, 'extra')
        if IO.Directory.Exists(pp):
            return pp
        elif IO.Directory.Exists(ppp):
            return ppp
예제 #9
0
def RunCommand():
    file_name = ""

    bitmap = doc.Views.ActiveView.CaptureToBitmap(True, True, True)

    # copy bitmap to clipboard
    Clipboard.SetImage(bitmap)

    # save bitmap to file
    save_file_dialog = Rhino.UI.SaveFileDialog()
    save_file_dialog.Filter = "*.bmp"
    save_file_dialog.InitialDirectory = \
      Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

    if save_file_dialog.ShowDialog() == DialogResult.OK:
        file_name = save_file_dialog.FileName

    if file_name != "":
        bitmap.Save(file_name)

    return Rhino.Commands.Result.Success
예제 #10
0
def GetUserDesktopFolderPath():
    return Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
예제 #11
0
파일: Gmail.py 프로젝트: soracoder/Apricot
    def onSignInClick(source, rea):
        config = None
        directory = Path.Combine(
            Environment.GetFolderPath(
                Environment.SpecialFolder.ApplicationData),
            Assembly.GetEntryAssembly().GetName().Name)
        backgroundBrush = None
        textColor = SystemColors.ControlTextBrush

        if Directory.Exists(directory):
            fileName1 = Path.GetFileName(Assembly.GetEntryAssembly().Location)

            for fileName2 in Directory.EnumerateFiles(directory, "*.config"):
                if fileName1.Equals(
                        Path.GetFileNameWithoutExtension(fileName2)):
                    exeConfigurationFileMap = ExeConfigurationFileMap()
                    exeConfigurationFileMap.ExeConfigFilename = fileName2
                    config = ConfigurationManager.OpenMappedExeConfiguration(
                        exeConfigurationFileMap, ConfigurationUserLevel.None)

        if config is None:
            config = ConfigurationManager.OpenExeConfiguration(
                ConfigurationUserLevel.None)
            directory = None

        if config.AppSettings.Settings["BackgroundImage"] is not None:
            fileName = config.AppSettings.Settings[
                "BackgroundImage"].Value if directory is None else Path.Combine(
                    directory,
                    config.AppSettings.Settings["BackgroundImage"].Value)
            fs = None
            bi = BitmapImage()

            try:
                fs = FileStream(fileName, FileMode.Open, FileAccess.Read,
                                FileShare.Read)

                bi.BeginInit()
                bi.StreamSource = fs
                bi.CacheOption = BitmapCacheOption.OnLoad
                bi.CreateOptions = BitmapCreateOptions.None
                bi.EndInit()

            finally:
                if fs is not None:
                    fs.Close()

            backgroundBrush = ImageBrush(bi)
            backgroundBrush.TileMode = TileMode.Tile
            backgroundBrush.ViewportUnits = BrushMappingMode.Absolute
            backgroundBrush.Viewport = Rect(0, 0, bi.Width, bi.Height)
            backgroundBrush.Stretch = Stretch.None

            if backgroundBrush.CanFreeze:
                backgroundBrush.Freeze()

        if backgroundBrush is None and config.AppSettings.Settings[
                "BackgroundColor"] is not None:
            if config.AppSettings.Settings["BackgroundColor"].Value.Length > 0:
                backgroundBrush = SolidColorBrush(
                    ColorConverter.ConvertFromString(
                        config.AppSettings.Settings["BackgroundColor"].Value))

                if backgroundBrush.CanFreeze:
                    backgroundBrush.Freeze()

        if config.AppSettings.Settings["TextColor"] is not None:
            if config.AppSettings.Settings["TextColor"].Value.Length > 0:
                textColor = ColorConverter.ConvertFromString(
                    config.AppSettings.Settings["TextColor"].Value)

        textBrush = SolidColorBrush(textColor)

        if textBrush.CanFreeze:
            textBrush.Freeze()

        window = Window()

        def onClick(source, args):
            global username, password

            if not String.IsNullOrEmpty(
                    usernameTextBox.Text) and not String.IsNullOrEmpty(
                        passwordBox.Password):
                username = usernameTextBox.Text
                password = passwordBox.Password

                def onSave():
                    try:
                        fs = None
                        sr = None
                        sw = None

                        try:
                            fs = FileStream(__file__, FileMode.Open,
                                            FileAccess.ReadWrite,
                                            FileShare.Read)
                            encoding = UTF8Encoding(False)
                            sr = StreamReader(fs, encoding, True)
                            lines = Regex.Replace(
                                Regex.Replace(
                                    sr.ReadToEnd(), "username\\s*=\\s*\"\"",
                                    String.Format("username = \"{0}\"",
                                                  username),
                                    RegexOptions.CultureInvariant),
                                "password\\s*=\\s*\"\"",
                                String.Format("password = \"{0}\"", password),
                                RegexOptions.CultureInvariant)
                            fs.SetLength(0)
                            sw = StreamWriter(fs, encoding)
                            sw.Write(lines)

                        finally:
                            if sw is not None:
                                sw.Close()

                            if sr is not None:
                                sr.Close()

                            if fs is not None:
                                fs.Close()

                    except Exception, e:
                        Trace.WriteLine(e.clsException.Message)
                        Trace.WriteLine(e.clsException.StackTrace)

                def onCompleted(task):
                    global menuItem

                    for window in Application.Current.Windows:
                        if window is Application.Current.MainWindow and window.ContextMenu is not None:
                            if window.ContextMenu.Items.Contains(menuItem):
                                window.ContextMenu.Items.Remove(menuItem)
                                window.ContextMenu.Opened -= onOpened

                                if window.ContextMenu.Items[10].GetType(
                                ).IsInstanceOfType(window.ContextMenu.Items[
                                        window.ContextMenu.Items.Count - 4]):
                                    window.ContextMenu.Items.RemoveAt(10)

                    menuItem = None

                Task.Factory.StartNew(
                    onSave, TaskCreationOptions.LongRunning).ContinueWith(
                        onCompleted,
                        TaskScheduler.FromCurrentSynchronizationContext())

            window.Close()
            "Author Name": dataAuthorName,
            "Author Email": dataAuthorEmail,
            "Last Tested On": dataTestedOn,
            "Rating": dataRating,
            "Keywords": dataKeywords
        }
    }

except Exception as ex:
    summary = ex.message

###############################################################################################################################
###########             CHANGE THE FILE PATH AND FILE NAME TO THE SHARED LOCATION               ###############################
###############################################################################################################################
tracker = Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
    'DynamoTracker_' + userName + '.csv')

trace = [
    userName, machineName, machineOS, machineProcessor, machineRam,
    machineVersion, appName, appNumber, appBuild, appLanguage, revitDoc,
    dynname, dynpath, lastSave, nodeCount, wireCount, dataOffice,
    dataAuthorName, dataAuthorEmail, dataTestedOn, dataRating, dataKeywords
]

headers = [
    'User: Username', 'Machine: Name', 'Machine: Operating System',
    'Machine: Processor', 'Machine: RAM', 'Machine: Version',
    'Application: Name', 'Application: Version', 'Application: Build Number',
    'Application: Language', 'Application: Document Path', 'Graph: Name',
    'Graph: Path', 'Graph: Last Saved', 'Graph: Node Count',
예제 #13
0
def onOpened(s, e):
    global menuItem

    menuItem.Items.Clear()

    config = None
    directory = Path.Combine(
        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
        Assembly.GetEntryAssembly().GetName().Name)

    if Directory.Exists(directory):
        fileName1 = Path.GetFileName(Assembly.GetEntryAssembly().Location)

        for fileName2 in Directory.EnumerateFiles(directory, "*.config"):
            if fileName1.Equals(Path.GetFileNameWithoutExtension(fileName2)):
                exeConfigurationFileMap = ExeConfigurationFileMap()
                exeConfigurationFileMap.ExeConfigFilename = fileName2
                config = ConfigurationManager.OpenMappedExeConfiguration(
                    exeConfigurationFileMap, ConfigurationUserLevel.None)

    if config is None:
        config = ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None)
        directory = None

    if config.AppSettings.Settings["ActivateThreshold"] is not None:
        threshold = Int64.Parse(
            config.AppSettings.Settings["ActivateThreshold"].Value)

        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "トーク間隔"
        else:
            childMenuItem.Header = "Talking Interval"

        menuItem.Items.Add(childMenuItem)

        intervalMenuItem1 = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            intervalMenuItem1.Header = "15秒"
        else:
            intervalMenuItem1.Header = "15 seconds"

        if threshold == 150000000:
            intervalMenuItem1.IsChecked = True

        def onIntervalClick1(sender, args):
            config.AppSettings.Settings[
                "ActivateThreshold"].Value = "150000000"
            config.Save(ConfigurationSaveMode.Modified)

        intervalMenuItem1.Click += onIntervalClick1

        childMenuItem.Items.Add(intervalMenuItem1)

        intervalMenuItem2 = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            intervalMenuItem2.Header = "30秒"
        else:
            intervalMenuItem2.Header = "30 seconds"

        if threshold == 300000000:
            intervalMenuItem2.IsChecked = True

        def onIntervalClick2(sender, args):
            config.AppSettings.Settings[
                "ActivateThreshold"].Value = "300000000"
            config.Save(ConfigurationSaveMode.Modified)

        intervalMenuItem2.Click += onIntervalClick2

        childMenuItem.Items.Add(intervalMenuItem2)

        intervalMenuItem3 = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            intervalMenuItem3.Header = "1分"
        else:
            intervalMenuItem3.Header = "1 minute"

        if threshold == 600000000:
            intervalMenuItem3.IsChecked = True

        def onIntervalClick3(sender, args):
            config.AppSettings.Settings[
                "ActivateThreshold"].Value = "600000000"
            config.Save(ConfigurationSaveMode.Modified)

        intervalMenuItem3.Click += onIntervalClick3

        childMenuItem.Items.Add(intervalMenuItem3)

        intervalMenuItem4 = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            intervalMenuItem4.Header = "2分"
        else:
            intervalMenuItem4.Header = "2 minutes"

        if threshold == 1200000000:
            intervalMenuItem4.IsChecked = True

        def onIntervalClick4(sender, args):
            config.AppSettings.Settings[
                "ActivateThreshold"].Value = "1200000000"
            config.Save(ConfigurationSaveMode.Modified)

        intervalMenuItem4.Click += onIntervalClick4

        childMenuItem.Items.Add(intervalMenuItem4)

        intervalMenuItem5 = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            intervalMenuItem5.Header = "3分"
        else:
            intervalMenuItem5.Header = "3 minutes"

        if threshold == 1800000000:
            intervalMenuItem5.IsChecked = True

        def onIntervalClick5(sender, args):
            config.AppSettings.Settings[
                "ActivateThreshold"].Value = "1800000000"
            config.Save(ConfigurationSaveMode.Modified)

        intervalMenuItem5.Click += onIntervalClick5

        childMenuItem.Items.Add(intervalMenuItem5)

    childMenuItem = MenuItem()

    if CultureInfo.CurrentCulture.Equals(CultureInfo.GetCultureInfo("ja-JP")):
        childMenuItem.Header = "テーマ"
    else:
        childMenuItem.Header = "Theme"

    menuItem.Items.Add(Separator())
    menuItem.Items.Add(childMenuItem)

    menuItem1 = MenuItem()
    menuItem2 = MenuItem()
    menuItem3 = MenuItem()
    menuItem4 = MenuItem()
    menuItem5 = MenuItem()
    menuItem6 = MenuItem()
    menuItem7 = MenuItem()
    menuItem8 = MenuItem()
    menuItem9 = MenuItem()
    menuItem10 = MenuItem()

    if CultureInfo.CurrentCulture.Equals(CultureInfo.GetCultureInfo("ja-JP")):
        menuItem1.Header = "ブループリント"
        menuItem2.Header = "ドット"
        menuItem3.Header = "布"
        menuItem4.Header = "リネン"
        menuItem5.Header = "ノイズ1"
        menuItem6.Header = "ノイズ2"
        menuItem7.Header = "紙"
        menuItem8.Header = "ペンタゴン"
        menuItem9.Header = "雪"
        menuItem10.Header = "ストライプ"
    else:
        menuItem1.Header = "Blueprint"
        menuItem2.Header = "Dots"
        menuItem3.Header = "Fabric"
        menuItem4.Header = "Linen"
        menuItem5.Header = "Noise 1"
        menuItem6.Header = "Noise 2"
        menuItem7.Header = "Paper"
        menuItem8.Header = "Pentagon"
        menuItem9.Header = "Snow"
        menuItem10.Header = "Stripes"

    if config.AppSettings.Settings[
            "BackgroundColor"] is not None and config.AppSettings.Settings[
                "BackgroundImage"] is not None and config.AppSettings.Settings[
                    "TextColor"] is not None and config.AppSettings.Settings[
                        "LinkColor"]:
        backColor = config.AppSettings.Settings["BackgroundColor"].Value
        backImage = config.AppSettings.Settings["BackgroundImage"].Value
        textColor = config.AppSettings.Settings["TextColor"].Value
        linkColor = config.AppSettings.Settings["LinkColor"].Value

        if backColor.Equals("#FF2574B0") and backImage.Equals(
                "Assets\\Background-Blueprint.png") and textColor.Equals(
                    "#FFFFFFFF") and linkColor.Equals("#FFFEEC27"):
            menuItem1.IsChecked = True

        def onClick1(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FF2574B0"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Blueprint.png"
            config.AppSettings.Settings["TextColor"].Value = "#FFFFFFFF"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFEEC27"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem1.Click += onClick1

        if backColor.Equals("#FF252525") and backImage.Equals(
                "Assets\\Background-Dots.png") and textColor.Equals(
                    "#FFFFFFFF") and linkColor.Equals("#FF00C0FF"):
            menuItem2.IsChecked = True

        def onClick2(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FF252525"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Dots.png"
            config.AppSettings.Settings["TextColor"].Value = "#FFFFFFFF"
            config.AppSettings.Settings["LinkColor"].Value = "#FF00C0FF"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem2.Click += onClick2

        if backColor.Equals("#FFEAEAEA") and backImage.Equals(
                "Assets\\Background-Fabric.png") and textColor.Equals(
                    "#FF000000") and linkColor.Equals("#FFFF0066"):
            menuItem3.IsChecked = True

        def onClick3(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FFEAEAEA"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Fabric.png"
            config.AppSettings.Settings["TextColor"].Value = "#FF000000"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF0066"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem3.Click += onClick3

        if backColor.Equals("#FF252525") and backImage.Equals(
                "Assets\\Background-Linen.png") and textColor.Equals(
                    "#FFFFFFFF") and linkColor.Equals("#FFFF6600"):
            menuItem4.IsChecked = True

        def onClick4(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FF252525"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Linen.png"
            config.AppSettings.Settings["TextColor"].Value = "#FFFFFFFF"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF6600"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem4.Click += onClick4

        if backColor.Equals("#FFF2F2F2") and backImage.Equals(
                "Assets\\Background-Noise1.png") and textColor.Equals(
                    "#FF333333") and linkColor.Equals("#FFFF0066"):
            menuItem5.IsChecked = True

        def onClick5(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FFF2F2F2"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Noise1.png"
            config.AppSettings.Settings["TextColor"].Value = "#FF333333"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF0066"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem5.Click += onClick5

        if backColor.Equals("#FF262727") and backImage.Equals(
                "Assets\\Background-Noise2.png") and textColor.Equals(
                    "#FFFFFFFF") and linkColor.Equals("#FFFF6600"):
            menuItem6.IsChecked = True

        def onClick6(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FF262727"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Noise2.png"
            config.AppSettings.Settings["TextColor"].Value = "#FFFFFFFF"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF6600"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem6.Click += onClick6

        if backColor.Equals("#FFFCFCFC") and backImage.Equals(
                "Assets\\Background-Paper.png") and textColor.Equals(
                    "#FF000000") and linkColor.Equals("#FFFF0099"):
            menuItem7.IsChecked = True

        def onClick7(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FFFCFCFC"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Paper.png"
            config.AppSettings.Settings["TextColor"].Value = "#FF000000"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF0099"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem7.Click += onClick7

        if backColor.Equals("#FFEEEEEE") and backImage.Equals(
                "Assets\\Background-Pentagon.png") and textColor.Equals(
                    "#FF333333") and linkColor.Equals("#FF00A0E9"):
            menuItem8.IsChecked = True

        def onClick8(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FFEEEEEE"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Pentagon.png"
            config.AppSettings.Settings["TextColor"].Value = "#FF333333"
            config.AppSettings.Settings["LinkColor"].Value = "#FF00A0E9"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem8.Click += onClick8

        if backColor.Equals("#FFFBFBFB") and backImage.Equals(
                "Assets\\Background-Snow.png") and textColor.Equals(
                    "#FF000000") and linkColor.Equals("#FF00A0E9"):
            menuItem9.IsChecked = True

        def onClick9(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FFFBFBFB"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Snow.png"
            config.AppSettings.Settings["TextColor"].Value = "#FF000000"
            config.AppSettings.Settings["LinkColor"].Value = "#FF00A0E9"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem9.Click += onClick9

        if backColor.Equals("#FF39343D") and backImage.Equals(
                "Assets\\Background-Stripes.png") and textColor.Equals(
                    "#FFFFFFFF") and linkColor.Equals("#FFFF6600"):
            menuItem10.IsChecked = True

        def onClick10(sender, args):
            config.AppSettings.Settings["BackgroundColor"].Value = "#FF39343D"
            config.AppSettings.Settings[
                "BackgroundImage"].Value = "Assets\\Background-Stripes.png"
            config.AppSettings.Settings["TextColor"].Value = "#FFFFFFFF"
            config.AppSettings.Settings["LinkColor"].Value = "#FFFF6600"
            config.Save(ConfigurationSaveMode.Modified)

        menuItem10.Click += onClick10

    childMenuItem.Items.Add(menuItem1)
    childMenuItem.Items.Add(menuItem2)
    childMenuItem.Items.Add(menuItem3)
    childMenuItem.Items.Add(menuItem4)
    childMenuItem.Items.Add(menuItem5)
    childMenuItem.Items.Add(menuItem6)
    childMenuItem.Items.Add(menuItem7)
    childMenuItem.Items.Add(menuItem8)
    childMenuItem.Items.Add(menuItem9)
    childMenuItem.Items.Add(menuItem10)

    if config.AppSettings.Settings["DropShadow"] is not None:
        dropShadow = Boolean.Parse(
            config.AppSettings.Settings["DropShadow"].Value)

        childMenuItem = MenuItem()
        childMenuItem.IsCheckable = True
        childMenuItem.IsChecked = dropShadow

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "ドロップシャドウを有効にする"
        else:
            childMenuItem.Header = "Enable Drop Shadow"

        def onClick(sender, args):
            config.AppSettings.Settings[
                "DropShadow"].Value = sender.IsChecked.ToString()
            config.Save(ConfigurationSaveMode.Modified)

        childMenuItem.Click += onClick

        menuItem.Items.Add(Separator())
        menuItem.Items.Add(childMenuItem)

    menuItem.Items.Add(Separator())

    if config.AppSettings.Settings["FontFamily"] is not None:
        fontFamilyName = config.AppSettings.Settings["FontFamily"].Value

        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "フォント"
        else:
            childMenuItem.Header = "Font"

        menuItem.Items.Add(childMenuItem)

        for fontFamily in [
                "Arial", "Calibri", "Cambria", "Candara", "Constantia",
                "Corbel", "Courier New", "Geogia", "MS UI Gothic", "Segoe UI",
                "Tahoma", "Times New Roman", "Verdana", "メイリオ", "MS ゴシック"
        ]:
            fontMenuItem = MenuItem()
            fontMenuItem.Header = fontFamily

            if fontFamily.Equals(fontFamilyName):
                fontMenuItem.IsChecked = True

            def onClick(sender, args):
                config.AppSettings.Settings["FontFamily"].Value = sender.Header
                config.Save(ConfigurationSaveMode.Modified)

            fontMenuItem.Click += onClick

            childMenuItem.Items.Add(fontMenuItem)

    if config.AppSettings.Settings["FontSize"] is not None:
        fontSize = config.AppSettings.Settings["FontSize"].Value

        fontSizeConverter = FontSizeConverter()
        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "フォントサイズ"
        else:
            childMenuItem.Header = "Font Size"

        menuItem.Items.Add(childMenuItem)

        for size in [
                "8pt", "9pt", "10pt", "11pt", "12pt", "14pt", "16pt", "18pt",
                "20pt", "22pt", "24pt"
        ]:
            fontMenuItem = MenuItem()
            fontMenuItem.Header = size

            if fontSize.Equals(size):
                fontMenuItem.IsChecked = True

            def onClick(sender, args):
                config.AppSettings.Settings["FontSize"].Value = sender.Header
                config.Save(ConfigurationSaveMode.Modified)

            fontMenuItem.Click += onClick

            childMenuItem.Items.Add(fontMenuItem)

        if config.AppSettings.Settings["LineHeight"] is not None:
            lineHeight = Double.Parse(
                config.AppSettings.Settings["LineHeight"].Value)
            maxLineHeight = Convert.ToInt32(
                fontSizeConverter.ConvertFromString(fontSize)) * 2

            if maxLineHeight < lineHeight:
                maxLineHeight = lineHeight

            childMenuItem2 = MenuItem()

            if CultureInfo.CurrentCulture.Equals(
                    CultureInfo.GetCultureInfo("ja-JP")):
                childMenuItem2.Header = "行間"
            else:
                childMenuItem2.Header = "Line Height"

            menuItem.Items.Add(childMenuItem2)

            for i in range(
                    Convert.ToInt32(
                        fontSizeConverter.ConvertFromString(fontSize)),
                    Convert.ToInt32(maxLineHeight) + 1):
                lineHeightMenuItem = MenuItem()
                lineHeightMenuItem.Header = i.ToString()

                if lineHeight == i:
                    lineHeightMenuItem.IsChecked = True

                def onClick(sender, args):
                    config.AppSettings.Settings[
                        "LineHeight"].Value = sender.Header
                    config.Save(ConfigurationSaveMode.Modified)

                lineHeightMenuItem.Click += onClick

                childMenuItem2.Items.Add(lineHeightMenuItem)

    if config.AppSettings.Settings["FrameRate"] is not None:
        frameRate = Double.Parse(
            config.AppSettings.Settings["FrameRate"].Value)

        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "フレームレート"
        else:
            childMenuItem.Header = "Frame Rate"

        menuItem.Items.Add(Separator())
        menuItem.Items.Add(childMenuItem)

        for i in [24, 30, 60]:
            frameRateMenuItem = MenuItem()
            frameRateMenuItem.Header = i.ToString()

            if frameRate == Convert.ToDouble(i):
                frameRateMenuItem.IsChecked = True

            def onClick(sender, args):
                config.AppSettings.Settings["FrameRate"].Value = sender.Header
                config.Save(ConfigurationSaveMode.Modified)

            frameRateMenuItem.Click += onClick

            childMenuItem.Items.Add(frameRateMenuItem)

    if config.AppSettings.Settings["Subscriptions"] is not None:
        path = config.AppSettings.Settings["Subscriptions"].Value

        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "フィード"
        else:
            childMenuItem.Header = "Subscriptions"

        menuItem.Items.Add(Separator())
        menuItem.Items.Add(childMenuItem)

        editMenuItem = MenuItem()
        editMenuItem.Tag = path

        def onEdit(sender, args):
            global program

            path = sender.Tag

            def onStart(state):
                Process.Start(state)

            psi = ProcessStartInfo()

            if String.IsNullOrEmpty(program):
                psi.FileName = path
            else:
                psi.FileName = program
                psi.Arguments = path

            Task.Factory.StartNew(onStart, psi)

        editMenuItem.Click += onEdit

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            editMenuItem.Header = "フィードの編集..."
        else:
            editMenuItem.Header = "Edit..."

        childMenuItem.Items.Add(editMenuItem)
        childMenuItem.Items.Add(Separator())

        if directory is not None:
            fileName = Path.Combine(directory, path)

            if File.Exists(fileName):
                path = fileName

        def parseOutline(m, n):
            if not n.HasChildNodes:
                return None

            for xmlNode in n.ChildNodes:
                if xmlNode.Name.Equals("outline"):
                    text = None
                    xmlUrl = None
                    htmlUrl = None

                    for xmlAttribute in xmlNode.Attributes:
                        if xmlAttribute.Name.Equals(
                                "title") or xmlAttribute.Name.Equals("text"):
                            text = xmlAttribute.Value
                        elif xmlAttribute.Name.Equals("xmlUrl"):
                            xmlUrl = xmlAttribute.Value
                        elif xmlAttribute.Name.Equals("htmlUrl"):
                            htmlUrl = xmlAttribute.Value

                    if not String.IsNullOrEmpty(text):
                        if String.IsNullOrEmpty(xmlUrl):
                            mi = MenuItem()
                            mi.Header = text

                            parsedMenuItem = parseOutline(mi, xmlNode)

                            if parsedMenuItem is None:
                                m.Items.Add(mi)
                            else:
                                m.Items.Add(parsedMenuItem)
                        elif not String.IsNullOrEmpty(xmlUrl):
                            mi = MenuItem()

                            def onClick(sender, args):
                                if not String.IsNullOrEmpty(sender.Tag):

                                    def onStart(state):
                                        Process.Start(state)

                                    Task.Factory.StartNew(onStart, sender.Tag)

                            mi.Header = text
                            mi.Click += onClick
                            mi.Tag = htmlUrl

                            m.Items.Add(mi)

            return m

        doc = XmlDocument()
        doc.Load(path)

        for xmlNode in doc.SelectNodes("/opml/body"):
            parseOutline(childMenuItem, xmlNode)

    if config.AppSettings.Settings["Timeout"] is not None:
        timeout = Int32.Parse(config.AppSettings.Settings["Timeout"].Value)

        childMenuItem = MenuItem()

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "タイムアウト"
        else:
            childMenuItem.Header = "Timeout"

        menuItem.Items.Add(Separator())
        menuItem.Items.Add(childMenuItem)

        for i in [15000, 30000, 60000, 120000, 180000]:
            timeMenuItem = MenuItem()
            timeMenuItem.Header = i.ToString()

            if timeout == i:
                timeMenuItem.IsChecked = True

            def onClick(sender, args):
                config.AppSettings.Settings["Timeout"].Value = sender.Header
                config.Save(ConfigurationSaveMode.Modified)

            timeMenuItem.Click += onClick

            childMenuItem.Items.Add(timeMenuItem)

    if config.AppSettings.Settings["Cache"] is not None:
        path = config.AppSettings.Settings["Cache"].Value

        if directory is not None:
            path = Path.Combine(directory, path)

        childMenuItem = MenuItem()
        childMenuItem.Tag = path

        if CultureInfo.CurrentCulture.Equals(
                CultureInfo.GetCultureInfo("ja-JP")):
            childMenuItem.Header = "キャッシュをクリア"
        else:
            childMenuItem.Header = "Clear Cache"

        def onClick(sender, args):
            if Directory.Exists(childMenuItem.Tag):
                for fileName in Directory.EnumerateFiles(childMenuItem.Tag):
                    File.Delete(fileName)

        childMenuItem.Click += onClick

        menuItem.Items.Add(Separator())
        menuItem.Items.Add(childMenuItem)

    childMenuItem = MenuItem()

    if CultureInfo.CurrentCulture.Equals(CultureInfo.GetCultureInfo("ja-JP")):
        childMenuItem.Header = "GCを強制的に実行"
    else:
        childMenuItem.Header = "Force Garbage Collection"

    def onClick(sender, args):
        GC.Collect()

    childMenuItem.Click += onClick

    menuItem.Items.Add(childMenuItem)
예제 #14
0
from System import Boolean, Byte, Int32, Double, String, StringComparison, Array, Type, Environment, Random
from System.IO import FileStream, MemoryStream, SeekOrigin, Path, Directory, File, FileMode, FileAccess, FileShare, SearchOption
from System.IO.Compression import ZipArchive
from System.Collections.Generic import List
from System.Configuration import ConfigurationManager, ConfigurationUserLevel, ExeConfigurationFileMap
from System.Globalization import CultureInfo
from System.Reflection import Assembly
from System.Xml.Linq import XDocument, XElement, XAttribute
from System.Xml.Serialization import XmlSerializer
from System.Windows import Point, Size
from Apricot import Character

config = None
directory = Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
    Assembly.GetEntryAssembly().GetName().Name)

if Directory.Exists(directory):
    fileName1 = Path.GetFileName(Assembly.GetEntryAssembly().Location)

    for fileName2 in Directory.EnumerateFiles(directory, "*.config"):
        if fileName1.Equals(Path.GetFileNameWithoutExtension(fileName2)):
            exeConfigurationFileMap = ExeConfigurationFileMap()
            exeConfigurationFileMap.ExeConfigFilename = fileName2
            config = ConfigurationManager.OpenMappedExeConfiguration(
                exeConfigurationFileMap, ConfigurationUserLevel.None)

if config is None:
    config = ConfigurationManager.OpenExeConfiguration(
        ConfigurationUserLevel.None)
예제 #15
0
# Script for MVC WebApp
import System
from System import Environment
import datetime
import sys

sys.path.append(r"C:\Users\carmitage\Dropbox\hg\Timesheet-Moose\MoosePy")
sys.path.append(r"C:\Python27\Lib")
from workinghours import hours_feed
from workinghours import hours_input
from workinghours import hours_estimator

logfile = Environment.GetFolderPath(
    Environment.SpecialFolder.MyDocuments) + r"\Timesheet.log"
hours = hours_input.readfromlog(logfile)
#hours = reversed(hours)
hours = hours_feed.calculate_estimated_hours(datetime.datetime.today(), hours)
hours = hours_estimator.get_estimated_hours(hours)
예제 #16
0
def GetLocalAppDataFolderPath():
    return Environment.GetFolderPath(
        Environment.SpecialFolder.LocalApplicationData)
예제 #17
0
파일: exportIFC.py 프로젝트: karthi1015/bim
# IN[3] - an output directory
# IN[4] - a viewname
if isinstance(IN[0], list):
    paths = IN[0]
else:
    paths = [IN[0]]

famMapFile = IN[1]
psetsFile = IN[2]

di = DirectoryInfo(IN[3])
if di.Exists:
    outpath = IN[3]
else:
    outpath = \
    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

viewName = IN[4]

Debug.WriteLine(famMapFile)

res = []
uiapp = DocMgr.Instance.CurrentUIApplication
app = DocMgr.Instance.CurrentUIApplication.Application
for p in paths:
    doc = OpenDocument(app, p)
    viewId = findViewByName(doc, viewName)
    expOpts = SetupIfcExpOpts(famMapFile, psetsFile, viewId)
    res.append(p + " - " + str(ExportToIfc(app, doc, expOpts, outpath)))
    doc.Close(False)
OUT = res
예제 #18
0
import clr
from System import Environment
OUT = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
    def PreRenderTasks(self):
        self.FailureMessage = ""
        self.Framecount = 0
        self.PreviousFrameTime = ""

        # Reset Slave Status Message between Tasks.
        self.SetStatusMessage("")

        # Check if we should be doing path mapping.
        sceneFilename = RepositoryUtils.CheckPathMapping(
            self.GetPluginInfoEntryWithDefault("SceneFile",
                                               self.GetDataFilename()))

        if SystemUtils.IsRunningOnMac():
            sceneFilename = sceneFilename.replace("\\", "/")
        else:
            sceneFilename = sceneFilename.replace("/", "\\")

        # We can only do path mapping on .aepx files (they're xml files).
        if (os.path.splitext(sceneFilename)[1]
            ).lower() == ".aepx" and self.GetBooleanConfigEntryWithDefault(
                "EnableAepxPathMapping", True):
            self.LogInfo("Performing path mapping on aepx project file")

            tempSceneDirectory = self.CreateTempDirectory(
                "thread" + str(self.GetThreadNumber()))
            tempSceneFileName = os.path.basename(sceneFilename)
            self.TempSceneFilename = os.path.join(tempSceneDirectory,
                                                  tempSceneFileName)

            if SystemUtils.IsRunningOnMac():
                RepositoryUtils.CheckPathMappingInFileAndReplace(
                    sceneFilename, self.TempSceneFilename,
                    ("\\", "platform=\"Win\""), ("/", "platform=\"MacPOSIX\""))
                os.chmod(self.TempSceneFilename,
                         os.stat(sceneFilename).st_mode)
            else:
                RepositoryUtils.CheckPathMappingInFileAndReplace(
                    sceneFilename, self.TempSceneFilename,
                    ("/", "platform=\"MacPOSIX\"", "\\>"),
                    ("\\", "platform=\"Win\"", "/>"))
                if SystemUtils.IsRunningOnLinux():
                    os.chmod(self.TempSceneFilename,
                             os.stat(sceneFilename).st_mode)
        else:
            self.TempSceneFilename = sceneFilename

        self.TempSceneFilename = PathUtils.ToPlatformIndependentPath(
            self.TempSceneFilename)

        # Get the path to the text file that forces After Effects to run the English version.
        if SystemUtils.IsRunningOnMac():
            myDocumentsPath = os.path.join(
                Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                "Documents/ae_force_english.txt")
        else:
            myDocumentsPath = os.path.join(
                Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                "ae_force_english.txt")

        # Check if we want to change After Effects to the English version. If we do, create the file.
        if self.GetBooleanConfigEntryWithDefault("ForceRenderingEnglish",
                                                 False):
            try:
                self.LogInfo(
                    "Attempting to create \"%s\" to force After Effects to run in English"
                    % myDocumentsPath)
                open(myDocumentsPath, 'w').close()
            except:
                self.LogWarning("Failed to create \"%s\" because %s" %
                                (myDocumentsPath, traceback.format_exc()))
        else:
            # If we don't want to force the English version, delete the file.
            if os.path.isfile(myDocumentsPath):
                try:
                    self.LogInfo(
                        "Attempting to delete \"%s\" to allow After Effects to run in the user's original language"
                        % myDocumentsPath)
                    os.remove(myDocumentsPath)
                except:
                    self.LogWarning("Failed to delete \"%s\" because %s" %
                                    (myDocumentsPath, traceback.format_exc()))

        myRePath = self.getAERenderOnlyFileName()

        # Check if we want to start After Effects in render engine mode. If we do, create the file. And important delete it later.
        if self.GetBooleanConfigEntryWithDefault("ForceRenderEngine", False):
            try:
                self.LogInfo(
                    "Attempting to create \"%s\" to force After Effects to run in Render Engine mode"
                    % myRePath)
                open(myRePath, 'w').close()
            except:
                self.LogWarning("Failed to create \"%s\" because %s" %
                                (myRePath, traceback.format_exc()))
        else:
            if self.GetBooleanConfigEntryWithDefault("DeleteRenderEngineFile",
                                                     False):
                # If we don't want to force in Render Engine mode, delete the file.
                if os.path.isfile(myRePath):
                    try:
                        self.LogInfo(
                            "Attempting to delete \"%s\" to allow After Effects to run in the workstation environment"
                            % myDocumentsPath)
                        os.remove(myRePath)
                    except:
                        self.LogWarning("Failed to delete \"%s\" because %s" %
                                        (myRePath, traceback.format_exc()))