/usr/lib/python3/dist-packages/windowmocker/plugins/base.py is in python3-windowmocker 1.4+14.04.20140220.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012-2014 Canonical, Ltd.
# Author: Thomi Richards
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Base classes for application type implementations."""
import logging
logger = logging.getLogger(__name__)
class ApplicationTypePluginBase(object):
"""A base class for all application type plugins."""
_window_default = {
'Title': "Default Window Title",
'Maximized': False,
'Minimized': False, # Start application minimized
'MinimizeImmediatelyAfterShow': False, # After starting, minimize immediately
'Menu': [],
'Contents': None
}
def __init__(self, spec_dictionary):
self.create_application()
if not spec_dictionary:
logger.warning("Specification contains no window specification. Creating a default window.")
if isinstance(spec_dictionary, dict):
window_spec = self._create_window_spec(spec_dictionary)
self.create_window(window_spec)
elif isinstance(spec_dictionary, list):
for window in spec_dictionary:
window_spec = self._create_window_spec(window)
self.create_window(window_spec)
def _create_window_spec(self, window_params):
"""Return a dictionary that contains window_params with all the defaults
added.
"""
defaults = self._window_default.copy()
defaults.update(window_params)
return defaults
def create_application(self):
"""Create an application."""
raise NotImplementedError(
"This method must be implemented by child classes.")
def create_window(self, window_spec):
"""Create a window, according to 'window_spec'."""
raise NotImplementedError(
"This method must be implemented by child classes.")
def run(self):
"""Enter the event loop - run the application & windows."""
raise NotImplementedError(
"This method must be implemented by child classes.")
|