Skip to content
Snippets Groups Projects
Commit 7f6ae93c authored by Bastien Montagne's avatar Bastien Montagne
Browse files

UITranslation: remove usage of register_module.

parent 1acd2888
Branches
Tags
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
bl_info = { bl_info = {
"name": "Manage UI translations", "name": "Manage UI translations",
"author": "Bastien Montagne", "author": "Bastien Montagne",
"version": (1, 1, 2), "version": (1, 1, 3),
"blender": (2, 75, 0), "blender": (2, 75, 0),
"location": "Main \"File\" menu, text editor, any UI control", "location": "Main \"File\" menu, text editor, any UI control",
"description": "Allow to manage UI translations directly from Blender " "description": "Allow to manage UI translations directly from Blender "
...@@ -53,8 +53,12 @@ else: ...@@ -53,8 +53,12 @@ else:
import os import os
classes = settings.classes + edit_translation.classes + update_svn.classes + update_addon.classes + update_ui.classes
def register(): def register():
bpy.utils.register_module(__name__) for cls in classes:
bpy.utils.register_class(cls)
bpy.types.WindowManager.i18n_update_svn_settings = \ bpy.types.WindowManager.i18n_update_svn_settings = \
bpy.props.PointerProperty(type=update_ui.I18nUpdateTranslationSettings) bpy.props.PointerProperty(type=update_ui.I18nUpdateTranslationSettings)
...@@ -68,5 +72,5 @@ def register(): ...@@ -68,5 +72,5 @@ def register():
def unregister(): def unregister():
del bpy.types.WindowManager.i18n_update_svn_settings del bpy.types.WindowManager.i18n_update_svn_settings
for cls in classes:
bpy.utils.unregister_module(__name__) bpy.utils.unregister_class(cls)
...@@ -308,3 +308,9 @@ class UI_OT_i18n_edittranslation(bpy.types.Operator): ...@@ -308,3 +308,9 @@ class UI_OT_i18n_edittranslation(bpy.types.Operator):
row.prop(self, "update_po", text="Save to PO File", toggle=True) row.prop(self, "update_po", text="Save to PO File", toggle=True)
row.prop(self, "update_mo", text="Rebuild MO File", toggle=True) row.prop(self, "update_mo", text="Rebuild MO File", toggle=True)
row.prop(self, "clean_mo", text="Erase Local MO files", toggle=True) row.prop(self, "clean_mo", text="Erase Local MO files", toggle=True)
classes = (
UI_OT_i18n_edittranslation_update_mo,
UI_OT_i18n_edittranslation,
)
...@@ -96,6 +96,7 @@ def _setattr(self, name, val): ...@@ -96,6 +96,7 @@ def _setattr(self, name, val):
print(self, name, val) print(self, name, val)
setattr(self, name, val) setattr(self, name, val)
class UI_AP_i18n_settings(bpy.types.AddonPreferences): class UI_AP_i18n_settings(bpy.types.AddonPreferences):
bl_idname = __name__.split(".")[0] # We want "top" module name! bl_idname = __name__.split(".")[0] # We want "top" module name!
bl_option = {'REGISTER'} bl_option = {'REGISTER'}
...@@ -195,3 +196,10 @@ class UI_AP_i18n_settings(bpy.types.AddonPreferences): ...@@ -195,3 +196,10 @@ class UI_AP_i18n_settings(bpy.types.AddonPreferences):
col = split.column() col = split.column()
col.operator("ui.i18n_settings_save", text="Save Persistent To...") col.operator("ui.i18n_settings_save", text="Save Persistent To...")
col.operator("ui.i18n_settings_load", text="Load Persistent From...") col.operator("ui.i18n_settings_load", text="Load Persistent From...")
classes = (
UI_OT_i18n_settings_load,
UI_OT_i18n_settings_save,
UI_AP_i18n_settings,
)
...@@ -333,3 +333,11 @@ class UI_OT_i18n_addon_translation_export(bpy.types.Operator): ...@@ -333,3 +333,11 @@ class UI_OT_i18n_addon_translation_export(bpy.types.Operator):
trans.write(kind='PO', langs=set(uids)) trans.write(kind='PO', langs=set(uids))
return {'FINISHED'} return {'FINISHED'}
classes = (
UI_OT_i18n_addon_translation_invoke,
UI_OT_i18n_addon_translation_update,
UI_OT_i18n_addon_translation_import,
UI_OT_i18n_addon_translation_export,
)
...@@ -221,3 +221,10 @@ class UI_OT_i18n_updatetranslation_svn_statistics(bpy.types.Operator): ...@@ -221,3 +221,10 @@ class UI_OT_i18n_updatetranslation_svn_statistics(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
wm = context.window_manager wm = context.window_manager
return wm.invoke_props_dialog(self) return wm.invoke_props_dialog(self)
classes = (
UI_OT_i18n_updatetranslation_svn_branches,
UI_OT_i18n_updatetranslation_svn_trunk,
UI_OT_i18n_updatetranslation_svn_statistics,
)
...@@ -221,3 +221,13 @@ class UI_OT_i18n_updatetranslation_svn_settings_select(bpy.types.Operator): ...@@ -221,3 +221,13 @@ class UI_OT_i18n_updatetranslation_svn_settings_select(bpy.types.Operator):
for lng in context.window_manager.i18n_update_svn_settings.langs: for lng in context.window_manager.i18n_update_svn_settings.langs:
lng.use = self.use_select lng.use = self.use_select
return {'FINISHED'} return {'FINISHED'}
classes = (
I18nUpdateTranslationLanguage,
I18nUpdateTranslationSettings,
UI_UL_i18n_languages,
UI_PT_i18n_update_translations_settings,
UI_OT_i18n_updatetranslation_svn_init_settings,
UI_OT_i18n_updatetranslation_svn_settings_select,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment