Skip to content

Commit

Permalink
reverting all committs since last release 2.7.0 in master branch as t…
Browse files Browse the repository at this point in the history
…hey should have been committed to dev branch
  • Loading branch information
mrflory committed May 23, 2020
1 parent bb328ee commit 66fc901
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 194 deletions.
108 changes: 54 additions & 54 deletions bkt/addin.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions bkt/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_attribute(self, attr):
self.event_name = attr

def register(self, method):
logging.debug("Method registered for event: %r", self.event_name)
logging.debug("Method registered for event: %r" % self.event_name)

if isinstance(method, Callback) and method.callback_type is None:
method.callback_type = CallbackTypes.bkt_event
Expand All @@ -40,7 +40,7 @@ def register(self, method):
return self

def unregister(self, method):
logging.debug("Method unregistered for event: %r", self.event_name)
logging.debug("Method unregistered for event: %r" % self.event_name)
self.registered_methods.remove(method)
return self

Expand Down Expand Up @@ -155,7 +155,7 @@ def destroy(self):
# ==========

def fire_event(self, event, **kwargs):
logging.debug("Event triggered: %r", event)
logging.debug("Event triggered: %r" % event)
for method in event:
try:
if isinstance(method, Callback):
Expand Down Expand Up @@ -201,12 +201,12 @@ def invoke_callback(self, context, callback, *args, **kwargs):
cache_key = str(callback.method) #TESTME: is method string representation sufficient as key? add callback type?
do_cache = True
try:
logging.debug("trying cache for %r", cache_key)
logging.debug("trying cache for %r" % cache_key)
return self.cache[cache_key]
# if time.time() - self.cache[cache_key][1] < self.cache_timeout:
# return self.cache[cache_key][0]
except KeyError:
logging.debug("no cache for %r", cache_key)
logging.debug("no cache for %r" % cache_key)

for i, arg in enumerate(args):
kwargs[callback.callback_type.pos_args[i]] = arg
Expand All @@ -225,7 +225,7 @@ def invoke_callback(self, context, callback, *args, **kwargs):
return

self.undo_start(callback)
logging.debug("AppCallbacksBase.invoke_callback: run callback method\nkwargs=%s", kwargs)
logging.debug("AppCallbacksBase.invoke_callback: run callback method\nkwargs=%s" % kwargs)
return_value = callback.method(**kwargs)
self.undo_end(callback)

Expand Down
12 changes: 6 additions & 6 deletions bkt/appui.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ def create_control(self, element, ribbon_id=None):
element_id = element.id
if element_id in self.custom_ribbon_uis[ribbon_id].lazy_replacements:
element = self.custom_ribbon_uis[ribbon_id].lazy_replacements[element_id]
logging.debug("create_control: element with id %s replaced by element with id %s", element_id, element.id)
logging.debug("create_control: element with id {} replaced by element with id {}".format(element_id, element.id))
if element_id in self.custom_ribbon_uis[ribbon_id].lazy_extensions:
element.children.extend( self.custom_ribbon_uis[ribbon_id].lazy_extensions[element_id] )
logging.debug("create_control: element with id %s extended", element_id)
logging.debug("create_control: element with id {} extended".format(element_id))

element.children = [self.create_control(c, ribbon_id=ribbon_id) for c in element.children ]
return element
Expand All @@ -241,15 +241,15 @@ def create_control(self, element, ribbon_id=None):
from bkt.factory import ControlFactory #@deprecated

if isinstance(element, ContainerUsage):
logging.debug("create_control for ContainerUsage: %s", element.container)
logging.debug("create_control for ContainerUsage: %s" % element.container)
return ControlFactory(element.container, ribbon_info=None).create_control()

else:
logging.warning("FeatureContainer used where instance of ContainerUsage was expected: %s", element)
logging.warning("FeatureContainer used where instance of ContainerUsage was expected: %s" % element)
return ControlFactory(element, ribbon_info=None).create_control()

else:
logging.warning("create_control for element %s skipped", element)
logging.warning("create_control for element {} skipped".format(element))



Expand Down Expand Up @@ -363,7 +363,7 @@ def create_taskpane_control(self):
image_name: _h.Resources.images.locate(image_name)
for image_name in stack_panel.collect_image_resources()
}
logging.debug('image resources: %s', image_resources)
logging.debug('image resources: %s' % image_resources)
taskpane_control = bkt.taskpane.BaseScrollViewer(
image_resources = image_resources,
children = [stack_panel]
Expand Down
14 changes: 7 additions & 7 deletions bkt/contextdialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def trigger_doubleclick(self, shape, context):
return self.module.trigger_doubleclick(shape, context)

except AttributeError:
logging.warning("ContextDialog.trigger_doubleclick: No double click action defined in module %s", self.module_name)
logging.warning("ContextDialog.trigger_doubleclick: No double click action defined in module %s" % self.module_name)

except:
logging.error(traceback.format_exc())
Expand Down Expand Up @@ -151,7 +151,7 @@ def import_module(self):
will not reload if module was already loaded
'''
if not self.module:
logging.debug('ContextDialog.import_module importing %s', self.module_name)
logging.debug('ContextDialog.import_module importing %s' % self.module_name)
#do an import equivalent to: import <<module_name>>
self.module = importlib.import_module(self.module_name)
# self.module = __import__(self.module_name, globals(), locals(), [], -1)
Expand Down Expand Up @@ -184,17 +184,17 @@ def __init__(self):

def register(self, id, module):
''' register a context dialog '''
logging.debug('ContextDialogs.register: id=%s', id)
logging.debug('ContextDialogs.register: id=%s' % id)
self.dialogs[id] = ContextDialog(id,module)

def register_dialog(self, context_dialog):
''' register a context dialog from context-dialog-object '''
logging.debug('ContextDialogs.register_dialog: id=%s', context_dialog.id)
logging.debug('ContextDialogs.register_dialog: id=%s' % context_dialog.id)
self.dialogs[context_dialog.id] = context_dialog

def unregister(self, id):
''' unregister a context dialog '''
logging.debug('ContextDialogs.unregister: id=%s', id)
logging.debug('ContextDialogs.unregister: id=%s' % id)
try:
del self.dialogs[id]
except KeyError:
Expand Down Expand Up @@ -278,7 +278,7 @@ def show_shape_dialog_for_shape(self, shape, context):
try:
ctx_dialog = self.dialogs[shape_tag]
except KeyError:
logging.warning('No dialog registered for given key: %s', shape_tag)
logging.warning('No dialog registered for given key: %s' % shape_tag)
return

self.active_dialog = ctx_dialog.show_dialog_at_shape_position(shape, context)
Expand Down Expand Up @@ -354,7 +354,7 @@ def trigger_doubleclick_for_shape(self, shape, context):
try:
ctx_dialog = self.dialogs[shape_tag]
except KeyError:
logging.warning('No dialog registered for given key: %s', shape_tag)
logging.warning('No dialog registered for given key: %s' % shape_tag)
return

ctx_dialog.trigger_doubleclick(shape, context)
Expand Down
18 changes: 7 additions & 11 deletions bkt/library/comrelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, comobj, release_self=True):
self._comobj = comobj
self._release_self = release_self
self._accessed_com_attributes = []
logging.debug("Com-Release: created %s", self)
logging.debug("Com-Release: created %s" % (self))


# Magic methods: https://rszalski.github.io/magicmethods/
Expand Down Expand Up @@ -76,11 +76,7 @@ def __isub__(self, other):
# def __str__(self): #__str__ not required as __repr__ returns a string

def __repr__(self):
try:
return "<AutoReleasingComObject for %s>" % (self._comobj)
except SystemError:
#in rare situations the com object is already released and logging calls __repr__ which throws SystemError
return "<AutoReleasingComObject for <DISPOSED COM OBJECT>>"
return "<AutoReleasingComObject for %s>" % (self._comobj)

def __dir__(self):
#this is essential for interactive python console
Expand Down Expand Up @@ -118,7 +114,7 @@ def __getattr__(self, attr):
return self

value = getattr(self._comobj, attr)
logging.debug("Com-Release: access to attribute %s", attr)
logging.debug("Com-Release: access to attribute %s" % (attr))

if type(value).__name__ != 'DispCallable':
# attribute did not return a function
Expand Down Expand Up @@ -229,12 +225,12 @@ def create_and_register_auto_release_com_object(self, com_obj):
if type(com_obj).__name__ == '__ComObject':
if self._is_comobj:
auto_release_com_obj = AutoReleasingComObject(com_obj, release_self=True)
logging.debug("Com-Release: created com-object %s", com_obj)
logging.debug("Com-Release: created com-object %s" % (com_obj))
else:
# self is no com-Object, but the attribute is.
# Hence, attribute is not generated here and should not be disposed.
# therefore: release_self=False
logging.debug("Com-Release: accessed existing com-object %s", com_obj)
logging.debug("Com-Release: accessed existing com-object %s" % (com_obj))
auto_release_com_obj = AutoReleasingComObject(com_obj, release_self=False)
self._accessed_com_attributes.append(auto_release_com_obj)

Expand All @@ -256,14 +252,14 @@ def dispose(self):
Therefore, all ComObjects accessed in the object-tree are released by a single dispose-call.
'''
# release ComObjects generated further down the object-tree
logging.debug("Com-Release: dispose on %s", self)
logging.debug("Com-Release: dispose on %s" % (self))
for auto_release_com_obj in self._accessed_com_attributes:
auto_release_com_obj.dispose()
self._accessed_com_attributes = []

# release wrapped ComObject
if self._release_self:
logging.debug("Com-Release: releasing %s", self)
logging.debug("Com-Release: releasing %s" % (self._comobj))
Marshal.ReleaseComObject(self._comobj)


Expand Down
8 changes: 4 additions & 4 deletions bkt/library/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def commit(self):

#do not create duplicates
if doc_hash in self._engine._docs:
logging.debug("SEARCH: duplicate doc hash %s", doc_hash)
logging.debug("SEARCH: duplicate doc hash "+str(doc_hash))
continue

#split comma-seperated values in list
Expand All @@ -156,7 +156,7 @@ def commit(self):
keywords = doc.keywords

self._engine._docs[doc_hash] = doc
logging.debug("SEARCH: commit document %s for keywords: %s", doc_hash, keywords)
logging.debug("SEARCH: commit document {} for keywords: {}".format(doc_hash, keywords))
for keyword in keywords:
keyword = keyword.lower()
self._engine._keywords.add(keyword)
Expand All @@ -178,7 +178,7 @@ def search(self, query, join_and=True):
join_and=True > multiple keywords are connected with AND
join_and=False > multiple keywords are connected with OR
'''
logging.debug("SEARCH: for %s", query)
logging.debug("SEARCH: for "+query)

#add to search history
self._engine.add_to_recent(query)
Expand Down Expand Up @@ -260,7 +260,7 @@ def search_exact(self, query, join_and=True):
join_and=True > multiple keywords are connected with AND
join_and=False > multiple keywords are connected with OR
'''
logging.debug("SEARCH EXACT: for %s", query)
logging.debug("SEARCH EXACT: for "+query)

#add to search history
self._engine.add_to_recent(query)
Expand Down
4 changes: 2 additions & 2 deletions bkt/library/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from __future__ import absolute_import, division #always force float-division, for int divison use //

import math
# import logging
import logging

from .algorithms import mean, median

Expand Down Expand Up @@ -192,7 +192,7 @@ def get_index(cell):
continue
index = get_index(cell)
if line_new[index] is not None:
# logging.debug("cell index %d is duplicated in line %d\r\nedges: %r" % (index,i,edges))
logging.debug("cell index %d is duplicated in line %d\r\nedges: %r" % (index,i,edges))
line_new = list(line)
while len(line_new) < num_cols:
line_new.append(None)
Expand Down
2 changes: 1 addition & 1 deletion bkt/ribbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, xml_name, id_tag=None, attributes={}, **kwargs):
self._attributes[self._id_attribute_key] = self.create_persisting_id()
# elif isinstance(self, Tab):
else:
logging.debug("Predefined ID found: %s (%s)", pre_id, self._attributes[pre_id])
logging.debug("Predefined ID found: %s (%s)" % (pre_id, self._attributes[pre_id]))
# enable callbacks for idMso tab (e.g. powerpoint contextual tabs)
self._id_attribute_key = pre_id

Expand Down
2 changes: 1 addition & 1 deletion bkt/taskpane.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def __init__(self, *args, **user_kwargs):

# add image resources
for image_name, image_path in self.image_resources.items():
logging.debug('image resource %s=%s', image_name, image_path)
logging.debug('image resource %s=%s' % (image_name, image_path))
resources_node.root.Add(
XmlPart('<BitmapImage x:Key="%s" UriSource="%s"/>' % (image_name, image_path)).wpf_xml()
)
Expand Down
4 changes: 2 additions & 2 deletions features/ppt_quickedit/quickedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def close_panel_for_active_window(cls, context, presentation):

@classmethod
def _show_panel(cls, context, windowid):
logging.debug("show panel for window %s", windowid)
logging.debug("show panel for window %s" % windowid)
try:
panel = cls._create_panel(context)
panel.SetOwner(windowid)
Expand All @@ -77,7 +77,7 @@ def _show_panel(cls, context, windowid):

@classmethod
def _close_panel(cls, windowid):
logging.debug("close panel for window %s", windowid)
logging.debug("close panel for window %s" % windowid)
try:
cls.panel_windows[windowid].Close()
del cls.panel_windows[windowid]
Expand Down
4 changes: 2 additions & 2 deletions features/ppt_quickedit/quickedit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def update_rgb_from_context(self, context):
if self.shade_index == -1:
color = pplib.ColorHelper.get_theme_color(context, self.color_index, brightness=self.brightness)
self.shade_index = color.shade_index
logging.debug("QuickEdit: shade index changed to %s", self.shade_index)
logging.debug("QuickEdit: shade index changed to %s" % str(self.shade_index))
elif self.shade_index is not None:
color = pplib.ColorHelper.get_theme_color(context, self.color_index, shade_index=self.shade_index)
self.brightness = color.brightness
logging.debug("QuickEdit: brightness changed to %s", self.brightness)
logging.debug("QuickEdit: brightness changed to %s" % str(self.brightness))
else:
color = pplib.ColorHelper.get_theme_color(context, self.color_index, brightness=self.brightness)
self.color_rgb = color.rgb
Expand Down
31 changes: 0 additions & 31 deletions features/ppt_quickedit/quickedit_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from System.Collections.ObjectModel import ObservableCollection
from System.Windows.Controls import Orientation
from System.Windows.Media import Colors, SolidColorBrush
from System.Windows import Visibility

import bkt.ui
Expand Down Expand Up @@ -51,7 +50,6 @@

VIEWSTATE_RECENT_HIDDEN = 1
DOCKING_SLIDE_LEFT = 2
DARK_THEME = 4

class ViewModel(bkt.ui.ViewModelSingleton):
def __init__(self, orientation_mode, window_left, window_top, viewstate):
Expand All @@ -63,9 +61,6 @@ def __init__(self, orientation_mode, window_left, window_top, viewstate):
self._viewstate = viewstate

self._editmode = False

self._brush_dark = SolidColorBrush(Colors.DimGray)
self._brush_light = SolidColorBrush(Colors.WhiteSmoke)

self._catalogs = ObservableCollection[QECatalog]()
for cat in QuickEdit._catalogs:
Expand Down Expand Up @@ -161,20 +156,6 @@ def recent_visibility(self):
return Visibility.Visible
else:
return Visibility.Collapsed

@notify_property
def color_background(self):
if self.dark_theme:
return self._brush_dark
else:
return self._brush_light

@notify_property
def color_foreground(self):
if self.dark_theme:
return self._brush_light
else:
return self._brush_dark

@notify_property
def recent_visible(self):
Expand All @@ -199,18 +180,6 @@ def docking_left(self, value):
# self.OnPropertyChanged("window_left")
# self.OnPropertyChanged("window_top")

@notify_property
def dark_theme(self):
return self._viewstate & DARK_THEME == DARK_THEME
@dark_theme.setter
def dark_theme(self, value):
if value:
self._viewstate = self._viewstate | DARK_THEME
else:
self._viewstate = self._viewstate ^ DARK_THEME
self.OnPropertyChanged("color_background")
self.OnPropertyChanged("color_foreground")

@notify_property
def window_left(self):
return self._left
Expand Down
Loading

0 comments on commit 66fc901

Please sign in to comment.