Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Sep 30, 2024
1 parent 80552e1 commit f986a60
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
19 changes: 10 additions & 9 deletions src/screencast_keys/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ class SK_OT_ScreencastKeys(bpy.types.Operator):
bl_idname = "wm.sk_screencast_keys"
bl_label = "Screencast Keys"
bl_description = "Display keys pressed"
bl_options = {'REGISTER', 'MODAL_PRIORITY'} if compat.check_version(4, 2, 0) >= 0 else {'REGISTER'}
bl_options = {'REGISTER', 'MODAL_PRIORITY'} \
if compat.check_version(4, 2, 0) >= 0 else {'REGISTER'}

# Last save time by auto save.
last_auto_saved_time = 0
Expand Down Expand Up @@ -1498,7 +1499,7 @@ def check_draw_status(cls, context, font_id, layer_name, calc_fn,
if region_drawn:
cls.draw_regions_prev.add(region.as_pointer())

# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
@staticmethod
def _do_auto_save_before_v41():
do_auto_save = False
Expand All @@ -1523,7 +1524,7 @@ def _do_auto_save_before_v41():
handler_ptr = cast(
handler.next, POINTER(cstruct.wmEventHandler))
return do_auto_save
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end

@staticmethod
def _do_auto_save_after_v42():
Expand Down Expand Up @@ -1639,7 +1640,7 @@ def auto_save(_):
prefs.filepaths.auto_save_time = prefs.filepaths.auto_save_time
cls.auto_saving = False

# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
@staticmethod
@bpy.app.handlers.persistent
def sort_modalhandlers(_):
Expand Down Expand Up @@ -1705,7 +1706,7 @@ def sort_modalhandlers(_):
handler = handlers.find(index)
handlers.remove(handler)
handlers.insert_after(prev, handler)
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end

def update_hold_modifier_keys(self, event):
"""Update hold modifier keys."""
Expand Down Expand Up @@ -1930,23 +1931,23 @@ def start(cls, self, context, event, prefs):
self.origin["space"] = context.space_data.as_pointer()
self.origin["region_type"] = context.region.type
context.area.tag_redraw()
# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
if prefs.get_event_aggressively:
bpy.app.handlers.depsgraph_update_pre.append(
cls.sort_modalhandlers)
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end
if prefs.auto_save:
bpy.app.handlers.depsgraph_update_pre.append(cls.auto_save)

cls.running = True

@classmethod
def stop(cls, self, context):
# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
if cls.sort_modalhandlers in bpy.app.handlers.depsgraph_update_pre:
bpy.app.handlers.depsgraph_update_pre.remove(
cls.sort_modalhandlers)
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end
if cls.auto_save in bpy.app.handlers.depsgraph_update_pre:
bpy.app.handlers.depsgraph_update_pre.remove(cls.auto_save)
self.event_timer_remove(context)
Expand Down
12 changes: 6 additions & 6 deletions src/screencast_keys/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,14 @@ class SK_Preferences(bpy.types.AddonPreferences):
default='LABEL_AND_IDNAME',
)

# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
get_event_aggressively: bpy.props.BoolProperty(
name="Get Event Aggressively",
description="(Experimental) Get events which will be dropped by the"
"other modalhandlers. This may make blender unstable",
default=not cstruct.NOT_SUPPORTED,
)
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end

auto_save: bpy.props.BoolProperty(
name="Auto Save",
Expand Down Expand Up @@ -507,14 +507,14 @@ def ui_in_overlay_update_fn(self, _):
type=DisplayEventTextAliasProperties
)

# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
# for add-on updater
updater_branch_to_update: EnumProperty(
name="branch",
description="Target branch to update add-on",
items=get_update_candidate_branches
)
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end

def draw(self, _):
layout = self.layout
Expand Down Expand Up @@ -700,7 +700,7 @@ def draw(self, _):
col = sp.column()
col.prop(d, "alias_text", text="")

# extensions.blender.org: Delete block start
# extensions.blender.org: Delete block start
elif self.category == 'UPDATE':
updater = AddonUpdaterManager.get_instance()

Expand Down Expand Up @@ -750,4 +750,4 @@ def draw(self, _):
elif updater.has_info():
box = layout.box()
box.label(text=updater.info(), icon='ERROR')
# extensions.blender.org: Delete block end
# extensions.blender.org: Delete block end
1 change: 1 addition & 0 deletions tools/remove_code_extensions.blender.org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TMP_DIR=$(mktemp -d)

REMOVE_FILES=(
"screencast_keys/utils/addon_updater.py"
"screencast_keys/c_structure/.*.py"
)

mkdir -p "${OUTPUT_DIR}"
Expand Down

0 comments on commit f986a60

Please sign in to comment.