Exemple #1
0
def togglestate():
    new_state = not script.get_envvar(SYNC_VIEW_ENV_VAR)
    # remove last datafile on start
    if new_state:
        # try:
        data_filename = get_data_filename(revit.doc)
        if os.path.exists(data_filename):
            os.remove(data_filename)
        # except Exception:
        #     pass
    script.set_envvar(SYNC_VIEW_ENV_VAR, new_state)
    script.toggle_icon(new_state)
Exemple #2
0
def toggle_state():
    dkeys = get_driver_keys()
    if dkeys:
        curval = query_filename_prompt_state(dkeys)

        if curval:
            logger.debug('Prompt For FileName is Enabled. Disabling...')
            set_filename_prompt_state(dkeys, False)
        else:
            logger.debug('Prompt For FileName is Disabled. Enabling...')
            set_filename_prompt_state(dkeys, True)

        script.toggle_icon(not curval)
        close_keys(dkeys)
Exemple #3
0
def __selfinit__(script_cmp, ui_button_cmp, __rvt__):
    try:
        abc = app.BackgroundColor
        bg_check1 = get_bg_col(abc)
        if bg_check1 == check_white:
            #print('Background is white!')
            bg_state = True
        else:
            #print('Background is not white!')
            bg_state = False
        script.toggle_icon(bg_state)
        return True
    except:
        return False
Exemple #4
0
def toggle_state():
    abc = app.BackgroundColor
    bg_check2 = get_bg_col(abc)

    if bg_check2 == check_white:
        #print('Background is white!')
        app.BackgroundColor = color_non_white
        bg_state = False
    else:
        #print('Background is not white!')
        app.BackgroundColor = color_white
        bg_state = True

    script.toggle_icon(bg_state)
Exemple #5
0
def toggle_state():
    abc = app.BackgroundColor
    bg_check2 = get_bg_col(abc)

    if bg_check2 == check_black:
        #print('Background is black!')
        app.BackgroundColor = color_white
        bg_state = True
    elif bg_check2 == check_white:
        #print('Background is not black!')
        app.BackgroundColor = color_black
        bg_state = False
    else:
        exit()

    script.toggle_icon(bg_state)
def switch():
    onoff = not isOn()
    setOnOff(onoff)
    script.toggle_icon(onoff)
    if onoff:
        #prevent multiple additions to eventhandler while switching on\off (remove if else (delete handler) works...)
        if not isEvenHandlerAdded():
            __revit__.ViewActivated += EventHandler[ViewActivatedEventArgs](
                awss)
            script.set_envvar(AUTO_WORKSET_SET_EVENTADDED, True)
        f.AutoSetWorkset()
        Alert('Auto Workset Set is activated!',
              title="neoCL | Auto Workset Set",
              header="neoCL")
    else:
        #does this line unloads eventhandler?
        __revit__.ViewActivated -= EventHandler[ViewActivatedEventArgs](awss)
        __revit__.ViewActivated -= awss
Exemple #7
0
def togglestate1():
    new_state = not script.get_envvar(SYNC_VIEW_ENV_VAR)
    script.set_envvar(SYNC_VIEW_ENV_VAR, new_state)
    script.toggle_icon(new_state)
Exemple #8
0
def togglestate():
    new_state = not envvars.get_pyrevit_env_var(SYNC_VIEW_ENV_VAR)
    envvars.set_pyrevit_env_var(SYNC_VIEW_ENV_VAR, new_state)
    script.toggle_icon(new_state)
Exemple #9
0
def toggle_minifyui(config):
    new_state = not script.get_envvar(MINIFYUI_ENV_VAR)
    script.set_envvar(MINIFYUI_ENV_VAR, new_state)
    script.toggle_icon(new_state)
    update_ui(config)
Exemple #10
0
    style_slots = tabs.get_styled_slots()
    if style_slots:
        index = 0
        print("Count: %s" % len(style_slots))
        for slot in style_slots:
            color = tabs.hex_from_brush(slot.Rule.Brush)[-6:]
            output.add_style(COLOR_TAG_STYLE_TEMPLATE.format(index, color))
            color_tag = COLOR_TAG_HTML_TEMPLATE.format(color, index)
            output.print_html('Slot: {} Id: {} with {}{}'.format(
                index, slot.Id, color_tag,
                ' (Family)' if slot.IsFamily else ''))
            index += 1


def reset_slots():
    """Reset doc colorizer"""
    tabs.reset_doc_colorizer()


if __name__ == '__main__':
    if __shiftclick__:  #pylint: disable=undefined-variable
        selected_option = forms.CommandSwitchWindow.show(
            ["List Document Colors", "Reset Theme"], message="Select option:")
        if selected_option == "List Document Colors":
            print_slots()
        elif selected_option == "Reset Theme":
            reset_slots()
    else:
        is_active = tabs.toggle_doc_colorizer()
        script.toggle_icon(is_active)
Exemple #11
0
COLOR_TAG_HTML_TEMPLATE = '<a title="{0}" class="doc-color-tag{1}">{0}</a>'


def __selfinit__(script_cmp, ui_button_cmp, __rvt__):
    button_icon = script_cmp.get_bundle_file(
        'on.png' if user_config.colorize_docs else 'off.png')
    ui_button_cmp.set_icon(button_icon, icon_size=ICON_MEDIUM)


# <System.Windows.Media.SolidColorBrush object at 0x0000000000001DE4 [#FF808080]>)

if __name__ == '__main__':
    if __shiftclick__:  #pylint: disable=undefined-variable
        print("Active: %s" % DocumentTabEventUtils.IsUpdatingDocumentTabs)
        if DocumentTabEventUtils.DocumentBrushes:
            print("Count: %s" % DocumentTabEventUtils.DocumentBrushes.Count)
            index = 0
            for k, v in dict(DocumentTabEventUtils.DocumentBrushes).items():
                color = re.findall(r'\#(.+)\]', repr(v))[0].lower()[-6:]
                output.add_style(COLOR_TAG_STYLE_TEMPLATE.format(index, color))
                color_tag = COLOR_TAG_HTML_TEMPLATE.format(color, index)
                output.print_html('Doc Id: {} with {}'.format(
                    str(k), color_tag))
                index += 1
    else:
        if DocumentTabEventUtils.IsUpdatingDocumentTabs:
            DocumentTabEventUtils.StopGroupingDocumentTabs()
        else:
            DocumentTabEventUtils.StartGroupingDocumentTabs(HOST_APP.uiapp)
        script.toggle_icon(DocumentTabEventUtils.IsUpdatingDocumentTabs)
Exemple #12
0
        json.dump(new_data, f)
    return TOGGLE


# ╔╦╗╔═╗╦╔╗╔
# ║║║╠═╣║║║║
# ╩ ╩╩ ╩╩╝╚╝ MAIN
#==================================================
if __name__ == '__main__':
    # GET TOGGLE
    TOGGLE = read_toggle_config()

    # ACTIVATE/DEACTIVATE ICON
    icon_on = os.path.join(PATH_SCRIPT, 'on.png')
    icon_off = os.path.join(PATH_SCRIPT, 'off.png')
    toggle_icon(TOGGLE, icon_on, icon_off)  #Change icon

    #CHECK LANGUAGE and GET TRANSLATIONS
    lang = str(app.Language)
    path_translation = None
    if "English" in lang:
        path_translation = os.path.join(PATH_SCRIPT, 'translation/ENG.json')
    elif "German" in lang:
        path_translation = os.path.join(PATH_SCRIPT, 'translation/DEU.json')
    else:
        print("{} - Unfortunately your language is not supported. "
              "You can submit your short names to me "
              "and it will be added to the list.".format(lang))

    # READ TRANSLATION DICTIONARY
    with codecs.open(path_translation, 'r', 'utf-8') as f:
Exemple #13
0
def togglestate():
    new_state = not script.get_envvar(SYNC_EXPLODE_ENV_VAR)
    script.set_envvar(SYNC_EXPLODE_ENV_VAR, new_state)
    script.toggle_icon(new_state)