Skip to content

Commit

Permalink
git subrepo pull uno
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "uno"
  merged:   "a2c4f2e2"
upstream:
  origin:   "https://github.com/prrvchr/uno.git"
  branch:   "main"
  commit:   "a2c4f2e2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
  • Loading branch information
prrvchr committed Dec 26, 2023
1 parent b06c47b commit dddbc7b
Show file tree
Hide file tree
Showing 32 changed files with 935 additions and 856 deletions.
4 changes: 2 additions & 2 deletions uno/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/prrvchr/uno.git
branch = main
commit = 306bc5f5d6965b82dceaf93de069e60680eec7f7
parent = 496017ee8eb2fb0db9fe50a943c14f93da3cc349
commit = a2c4f2e226b9b557738468062e1b832cadf13bd3
parent = b06c47bba6a51dac7193b011116f0c3b9c829c1f
method = merge
cmdver = 0.4.3
2 changes: 1 addition & 1 deletion uno/lib/uno/logger/dialog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@

from .logmanager import LogManager

from .loglistener import LoggerListener
from .loghandler import LoggerListener

23 changes: 11 additions & 12 deletions uno/lib/uno/logger/dialog/loghandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def callHandlerMethod(self, dialog, event, method):
handled = True
return handled
except Exception as e:
msg = "Error: %s" % traceback.format_exc()
msg = f"Error: {traceback.format_exc()}"
print(msg)

def getSupportedMethodNames(self):
Expand All @@ -95,43 +95,42 @@ def callHandlerMethod(self, dialog, event, method):
handled = True
return handled
except Exception as e:
msg = "Error: %s" % traceback.format_exc()
msg = f"Error: {traceback.format_exc()}"
print(msg)

def getSupportedMethodNames(self):
return ('LogInfo', )


class PoolListener(unohelper.Base,
XModifyListener):
class LoggerListener(unohelper.Base,
XModifyListener):
def __init__(self, manager):
self._manager = manager

# XModifyListener
def modified(self, event):
try:
print("PoolListener.modified()")
self._manager.updateLoggers()
self._manager.updateLogger()
except Exception as e:
msg = "Error: %s" % traceback.format_exc()
msg = f"Error: {traceback.format_exc()}"
print(msg)

def disposing(self, event):
pass


class LoggerListener(unohelper.Base,
XModifyListener):
class PoolListener(unohelper.Base,
XModifyListener):
def __init__(self, manager):
self._manager = manager

# XModifyListener
def modified(self, event):
try:
print("LoggerListener.modified()")
self._manager.updateLogger()
print("PoolListener.modified()")
self._manager.updateLoggers()
except Exception as e:
msg = "Error: %s" % traceback.format_exc()
msg = f"Error: {traceback.format_exc()}"
print(msg)

def disposing(self, event):
Expand Down
71 changes: 0 additions & 71 deletions uno/lib/uno/logger/dialog/loglistener.py

This file was deleted.

9 changes: 4 additions & 5 deletions uno/lib/uno/logger/dialog/logmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@

from .loghandler import WindowHandler
from .loghandler import DialogHandler

from .loglistener import PoolListener
from .loglistener import LoggerListener
from .loghandler import LoggerListener
from .loghandler import PoolListener

from ..loghelper import getLoggerName

Expand All @@ -58,7 +57,7 @@
class LogManager(unohelper.Base):
def __init__(self, ctx, parent, infos, filter, *defaults):
self._ctx = ctx
self._model = LogModel(ctx, PoolListener(self), *defaults)
self._model = LogModel(ctx, PoolListener(self), defaults)
self._view = LogWindow(ctx, WindowHandler(self), parent)
self._infos = infos
self._filter = filter
Expand Down Expand Up @@ -87,7 +86,7 @@ def loadSetting(self):
self.disableHandler()
self._view.setLogSetting(self._model.loadSetting())

# LogManager setter methods called by PoolListener
# LogManager setter methods called by LoggerListener
def updateLoggers(self):
logger = self._view.getLogger()
loggers = self._model.getLoggerNames(self._filter)
Expand Down
2 changes: 1 addition & 1 deletion uno/lib/uno/logger/dialog/logmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


class LogModel(LogController):
def __init__(self, ctx, listener, *names):
def __init__(self, ctx, listener, names):
self._ctx = ctx
self._basename = g_basename
self._pool = LoggerPool(ctx)
Expand Down
6 changes: 3 additions & 3 deletions uno/lib/uno/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def hasEntryForId(self, resource):
return False
return self._resolver.hasEntryForId(resource)

def resolveString(self, resource, args):
def resolveString(self, resource, arguments):
if self.hasEntryForId(resource):
msg = self._resolver.resolveString(resource)
if args:
msg = msg % args
if arguments:
msg = msg.format(*arguments)
else:
msg = resource
return msg
Expand Down
1 change: 0 additions & 1 deletion uno/lib/uno/logger/loggerpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def _getNamedLogger(self, name):
toadd = name not in LoggerPool._loggers
if toadd:
LoggerPool._loggers[name] = []
print("LoggerPool._getNamedLogger() %s" % name)
logger = self._pool.getNamedLogger(name)
if toadd:
self._notifyListener()
Expand Down
20 changes: 9 additions & 11 deletions uno/lib/uno/logger/loghelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _getErrorMessage(self, resource):
return self._resolveErrorMessage(resolver, resource)

def _resolveErrorMessage(self, resolver, resource):
return resolver.resolveString(151) % (resource, self._url, self._basename)
return resolver.resolveString(121).format(resource, self._url, self._basename)


# This LogController allows using listener and access content of logger
Expand Down Expand Up @@ -166,46 +166,44 @@ def dispose(self):
self._logger.removeModifyListener(self._listener)

def logInfos(self, level, infos, clazz, method):
msg = self._resolver.resolveString(111) % ' '.join(sys.version.split())
msg = self._resolver.resolveString(111).format(' '.join(sys.version.split()))
self._logger.logp(level, clazz, method, msg)
msg = self._resolver.resolveString(112) % os.pathsep.join(sys.path)
msg = self._resolver.resolveString(112).format(os.pathsep.join(sys.path))
self._logger.logp(level, clazz, method, msg)
for name, info in infos.items():
try:
mod = importlib.import_module(name)
except Exception as e:
msg = self._resolver.resolveString(113) % (name, e, traceback.format_exc())
msg = self._resolver.resolveString(113).format(name, e, traceback.format_exc())
else:
attr, minimum = info
unknown = '<unknown>'
path = getattr(mod, '__file__', unknown)
if not path:
path = unknown
if attr is None:
msg = self._resolver.resolveString(114) % (name, minimum, path)
msg = self._resolver.resolveString(114).format(name, minimum, path)
elif hasattr(mod, attr):
version = getattr(mod, attr)
if minimum is None or checkVersion(version, minimum):
msg = self._resolver.resolveString(114) % (name, version, path)
msg = self._resolver.resolveString(114).format(name, version, path)
else:
msg = self._resolver.resolveString(115) % (name, version, path, minimum)
msg = self._resolver.resolveString(115).format(name, version, path, minimum)
else:
modattr = ', '.join(dir(mod))
msg = self._resolver.resolveString(116) % (name, path, modattr)
msg = self._resolver.resolveString(116).format(name, path, modattr)
self._logger.logp(level, clazz, method, msg)

def clearLogger(self):
url = getRollerHandlerUrl(self._ctx, self.Name)
sf = getSimpleFile(self._ctx)
if sf.exists(url):
sf.kill(url)
print("LogController.clearLogger() 1")
msg = self._resolver.resolveString(161)
msg = self._resolver.resolveString(131)
handler = RollerHandler(self._ctx, self.Name)
self.addRollerHandler(handler)
self._logMessage(SEVERE, msg, 'Logger', 'clearLogger()')
self.removeRollerHandler(handler)
print("LogController.clearLogger() 2")

def addModifyListener(self, listener):
self._logger.addModifyListener(listener)
Expand Down
19 changes: 6 additions & 13 deletions uno/lib/uno/options/ucb/optionsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

from ..configuration import g_identifier
from ..configuration import g_defaultlog
from ..configuration import g_synclog

from collections import OrderedDict
import os
Expand All @@ -54,7 +55,7 @@ def __init__(self, ctx, window):
resumable = self._model.isResumable()
data = self._model.getViewData()
self._view = OptionsView(window, exist, resumable, data)
self._logger = LogManager(ctx, window.Peer, self._getInfos(), g_identifier, g_defaultlog)
self._logger = LogManager(ctx, window.Peer, self._getInfos(), g_identifier, g_defaultlog, g_synclog)

def saveSetting(self):
share, name, index, timeout, download, upload = self._view.getViewData()
Expand All @@ -74,7 +75,7 @@ def enableTimeout(self, enabled):

def viewData(self):
url = self._model.getDatasourceUrl()
getDesktop(self._ctx).loadComponentFromURL(url, '_blank', 0, ())
getDesktop(self._ctx).loadComponentFromURL(url, '_default', 0, ())

def download(self):
self._view.setStep(1)
Expand All @@ -84,17 +85,9 @@ def upload(self):

def _getInfos(self):
infos = OrderedDict()
version = ' '.join(sys.version.split())
infos[111] = version
path = os.pathsep.join(sys.path)
infos[112] = path
# Required modules for ijson
try:
import ijson
except Exception as e:
infos[136] = self._getExceptionMsg(e)
else:
infos[137] = ijson.__version__, ijson.__file__
infos['ijson'] = ('__version__', '3.2.2')
infos['packaging'] = ('__version__', '23.1')
infos['six'] = ('__version__', '1.16.0')
return infos

def _getExceptionMsg(self, e):
Expand Down
Loading

0 comments on commit dddbc7b

Please sign in to comment.