Menu

moddiutils

Stefan Meinlschmidt

moddiutils

moddiutils are a more or less random collection of Python3 code from the patchmaster project but not specific to it.

moddiutils are open source, they are available under the terms of the MIT license.

Content

As of 2017-12-15 moddiutils contain:

identifier what it does
moddiutils.EXPORT Decorator maintaining __all__
moddiutils.Struct Simple object with members set from the constructor (alternative to collections.namedtuple)
moddiutils.format_args Prettyprinting args and kwargs
moddiutils.Overlay, moddiutils.OverlayStruct Wrap an object to add methods
moddiutils.methodify Decorator turning a member class into something aware of (the parent’s) self
moddiutils.neuter Decorator swallowing a function’s return value
moddiutils.Immortal Base class for objects immune to garbage collection
moddiutils.tobytes Convert about everything into bytes, possibly turning it into a string first
moddiutils.LogContext Context manager calling some log function upon __enter__ and __exit__
moddiutils.MroMap Dictinary (-lookalike) with classes as key where you can retrieve by most-derived base class
moddiutils.async Subpackage implementing an asyncronous execution model, described on its own page
moddiutils.config.Stack Common interface to configuration data from environment and config file(s) (.ini format for now)
moddiutils.inspect.Genfunc Turn both normal and generator functions into something that can be uniformly used as a generator function
moddiutils.inspect.Plainfunc Turn both normal and generator functions into something that can be uniformly called as a normal function
moddiutils.plugin Subpackage for finding, loading and unloading Python files and registering and enumerating the contained things (docu pending)
moddiutils.resources.mkfuncs Tool to access non-Python-files within some package
moddiutils.threading “Wrapper” around Python’s threading, i.e. import instead
moddiutils.threading.Threadlocal Similar to moddiutils.Struct, but each thread has its own copy
moddiutils.threading.Gate Simple proceed-or-not signalling between threads
moddiutils.threading.ExceptionForwarder Forwards exceptions to some callback
moddiutils.threading.Thread threading.Thread augmented with exception forwarding
moddiutils.threading.ExceptionEvent threading.Event lookalike able to forward exceptions
moddiutils.timer.Timer Thread you can post callbacks to to be called after some delay
moddiutils.timer.Alarm Callback that can post itself to an internal moddiutils.timer.Timer
moddiutils.timer.Recoverer Delay calls as needed to limit call frequency
moddiutils.timer.Swallower Delay and drop calls as needed to limit call frequency
moddiutils.tk Stuff to make tkinter more bearable
moddiutils.tk.TkCallback Wrapper around some callable swallowing (event) arguments and returning 'break'
moddiutils.tk.ScrollWrap Wrapper around some tkinter widget adding scrollbars
moddiutils.tk.tooltip Add tooltip to widget
moddiutils.tk.app.App Base for a proper, non-blocking, tkinter application, maintaining a worker thread, means to inject calls back into the GUI thread and an exception dialog
moddiutils.tk.help.HelpBrowser Window displaying HTML help (in limited HTML)
moddiutils.tk.html Sort of an HTML browser widget, described on its own page
moddiutils.tk.modal Subsystem for modal dialogs
moddiutils.tk.modal.modal_active check whether something modal is open
moddiutils.tk.modal.Modal Base class for modal dialogs
moddiutils.tk.modal.ErrorBox Display longish error information (e.g. some exception)
moddiutils.tk.modal.YnBox, moddiutils.tk.modal.yndialog, moddiutils.tk.modal.YnaBox, moddiutils.tk.modal.ynadialog Humble replacement for tkinter.tkMessageBox.askyesno, honouring the modal system
moddiutils.xml.Handler Abstract interface for building an XML tree
moddiutils.xml.Root Mixin for building your own Handler
moddiutils.xml.Document XML tree capable of turning into events or a byte stream again, i.e. you can use it to create XML files from Python in a structured way
moddiutils.xml.parse, moddiutils.xml.source, moddiutils.xml.parse_file Very much unfinished means to parse a file or URL containing proper XML or some HTMLish tag soup into some moddiutils.xml.Handler, possibly a moddiutils.xml.Document

Use

moddiutils are meant to be part of some bigger project (patchmaster and ewi4000s-editor in my case), so you should simply copy the whole subdirectory into your project’s root so it acts as a package. If your own project uses GIT for version control, you might consider using git-subrepo to clone it directly into your project from git://git.code.sf.net/p/patchmaster/moddiutils.

In any case you should not happily update to the newest version all the time – I do not guarantee to keep versions compatible in any way, i.e. any new version will probably break something in your project. If you need or really want to update, be prepared for that extra effort and frustration. If you don’t need or really want, don’t do it.


Related

Wiki: Home
Wiki: moddiutils.async
Wiki: moddiutils.tk.html

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.