Classes | Namespaces | Functions
INIXApp.py File Reference

Classes

class  INIXApp.ResourceInstance
 Represents a resource and manages its state. More...
 

Namespaces

 INIXApp
 Defines the ResourceInstance class that implements most of the main functionality of INIXApp, as well as a few helper functions for use by scripts in INIXApp resources.
 

Functions

def INIXApp.GetResourceInstance
 Get the ResourceInstance object for a given index path. More...
 
def INIXApp.AddKeyboardEquivalent
 Add a keyboard equivalent to the command menu item aCommandIndexPath, owned by resource aResourceIndexPath. More...
 
def INIXApp.ShowOutwinAndExecProg
 Run an external command, displaying its output in the status bar. More...
 
def INIXApp.StatusPost
 Post a status message on the INIXApp status bar. More...
 
def INIXApp.StatusUpdate
 Update a status message on the INIXApp status bar. More...
 
def INIXApp.StatusClear
 Mark a status message on the INIXApp status bar as invalid. More...
 
def INIXApp.ResourceStart
 Trampoline code for resources' commands.py. More...
 

Detailed Description

Author
Christian Walther walth.nosp@m.er@i.nosp@m.ndel..nosp@m.ch, © INDEL AG
Version
        207, 2006-11-14 09:47:09 +0100 (Di, 14 Nov 2006), walther
        ! Completely overhauled INIXApp.

        263, 2007-01-29 11:16:25 +0100 (Mo, 29 Jan 2007), walther
        + Added facility for dynamic (script-created) command menus.

        270, 2007-02-02 15:38:32 +0100 (Fr, 02 Feb 2007), walther
        + Command menu items (both static and dynamically generated) can now have
          keyboard equivalents.

        1470, 2007-03-23 16:53:47 +0100 (Fr, 23 Mrz 2007), walther
        ! Better error message in case of wrong number of arguments.

        1474, 2007-03-26 15:20:52 +0200 (Mon, 26 Mar 2007), walther
        + Added the INIXApp.AddResource() Python function that allows resources to
          insert arbitrary other resources into the application at arbitrary
          places in the resource hierarchy. In the course of this, refactored the
          INIXAppInternal.Select() function to separate displaying and selecting a
          resource.

        1731, 2007-07-13 17:02:45 +0200 (Fr, 13 Jul 2007), walther
        ! Adaptation to the case-sensitive file system and the undefined
          INDEL_ROOT environment variable on Linux.

        1855, 2007-09-04 11:58:05 +0200 (Di, 04 Sep 2007), walther
        + User commands can now be assigned keyboard equivalents.

        2130, 2007-11-14 14:07:41 +0100 (Mi, 14 Nov 2007), walther
        ! Extensive internal reorganization of INIXApp. Main change is that
          resource state is no longer stored in the INCO tree, but in a Python
          object. OnDidEnter etc. scripts are replaced by methods of that object,
          defined in a single file 'resource.py'. Handling of commands with the
          'commands.py' script is currently unaffected, but may be adapted to the
          new system later.

        2156, 2007-11-19 08:53:58 +0100 (Mo, 19 Nov 2007), walther
        ! Marked the resourceDefaults attribute as public.

        2159, 2007-11-20 14:40:14 +0100 (Di, 20 Nov 2007), walther
        + Added a ResourceInstance.Remove method to remove a resource from the
          application, complementary to AddResource. This ability destroys some
          invariants, which prompted the following additional changes:
        ! Replaced GetName() by a 'name' attribute. Names are now made unique among
          sibling resources.
        ! AddResource can now add resources without immediately displaying them.
        ! Preferences files are now named by resource names instead of index paths,
          and open subresources are kept track of by name instead of index.
          Backwards compatibility with existing preferences files is provided in
          both cases.
        ! Fixed subworkplaces being restored in the wrong order.
        ! Some documentation tweaks.

        2167, 2007-11-21 14:10:44 +0100 (Mi, 21 Nov 2007), walther
        ! Added missing import statement (it had worked for me without because I
          had an old version of inix32 where "from inix32 import *" included os).

        2212, 2007-11-29 15:49:01 +0100 (Do, 29 Nov 2007), walther
        + Added a ResourceInstance.FindResource method to find the absolute file
          system path of a resource from _Resources_.
        + Added a ResourceInstance.__repr__ method to get more useful debug output.
        ! Fixed default subresources not opening automatically.

        2213, 2007-11-29 16:01:32 +0100 (Do, 29 Nov 2007), walther
        ! Eliminated commands.py: Everything that was handled by functions from
          commands.py before is now handled by methods of the ResourceInstance
          object (defined in resource.py).
        + Introduced the PopulateCommandsMenu method that can be overridden to
          control dynamic menu building from the beginning, particularly useful if
          an empty menu should be hidden.
        ! Replaced the commandsIndex attribute by commandsIndexPath (with the
          obvious change in meaning).

        2227, 2007-11-29 17:29:40 +0100 (Do, 29 Nov 2007), walther
        ! Removed leftover debug output.

        2233, 2007-11-30 11:07:33 +0100 (Fr, 30 Nov 2007), walther
        ! Make all command menu items explicitly expandable/collapsible, not just
          the top level, as users invariably find that distinction confusing.

        2239, 2007-12-03 15:24:12 +0100 (Mo, 03 Dez 2007), walther
        + Added GetTarget and OnTargetChanged methods analogous to those of
          CINIXPlugin on the C++ side.

        2249, 2007-12-04 14:20:12 +0100 (Di, 04 Dez 2007), walther
        ! Fixed: mutable objects (lists or dictionaries) in ResourceDefaults
          weren't saved even when modified.

        2287, 2007-12-14 14:36:44 +0100 (Fr, 14 Dez 2007), walther
        ! Fixed a Python error when loading resources whose static commands had
          keyboard equivalents.

        2288, 2007-12-14 14:52:46 +0100 (Fr, 14 Dez 2007), walther
        ! Removed the hack of using "<" in PageDefaults to specify work place
          properties (e.g. size) and introduced WorkPlaceDefaults instead.

        2290, 2007-12-14 17:10:03 +0100 (Fr, 14 Dez 2007), walther
        ! Restore work place properties before creating/showing the page since the
          page might depend on them (appeventlog does).

        2306, 2007-12-17 15:12:57 +0100 (Mo, 17 Dez 2007), walther
        ! Removed leftover debug output from r2290.

        2320, 2007-12-18 07:12:45 +0100 (Di, 18 Dez 2007), zulliger
        ! Changes related to the renaming of libinix32 to inco_32

        2465, 2008-02-04 14:25:26 +0100 (Mo, 04 Feb 2008), zulliger
 + All the properties from the resource.prp files are now stored as
   self.properties. Therefore, a derived class has the ability to access the
   dictionary defined in the .prp file and thus, arbitrary data can be stored
   in the prp file which may be used to perform whatever actions.

        2476, 2008-02-04 16:25:56 +0100 (Mo, 04 Feb 2008), walther
        ! Expanded the resources search path (used to locate base, subresources
          etc.), with the goals that: - resources located in the same _Resources_
          folder can refer to each other by name, - INIXApp can run in an
          uninstalled version of $INDEL_ROOT/share/resource, e.g.
          inixdev/igd/resource.

        2490, 2008-02-06 08:03:58 +0100 (Mi, 06 Feb 2008), walther
        ! Removed leftover debug output from r2476.

        2555, 2008-02-13 11:16:08 +0100 (Mi, 13 Feb 2008), walther
        ! Don't display a keyboard equivalent in the menu if it failed to register
          at the hotkey service.

        2569, 2008-02-18 14:56:22 +0100 (Mo, 18 Feb 2008), walther
        ! Redesigned handling of commands for more flexible inheritance. Derived
          resources can now add, remove, modify, and rearrange (static) menu
          items, even if the base only has dynamic ones. The Commands property
          must now always be a list, "DYNAMIC" entries don't create whole submenus
          anymore but are placeholders for (any number of) individual dynamic
          items.

        2577, 2008-02-19 07:49:04 +0100 (Di, 19 Feb 2008), walther
        ! Moved ShowOutwinAndExecProg() to INIXApp and the outwin resource to
          resources/misc.

        2632, 2008-03-03 14:37:49 +0100 (Mo, 03 Mrz 2008), walther
        + Adding the beginnings of a variables panel that can hold user-defined or
          resource-defined pages of variables. Still missing: variables are not
          saved on shutdown, no mechanism for resources to provide pages, and
          more.

        2633, 2008-03-04 14:09:26 +0100 (Di, 04 Mrz 2008), walther
        ! Improved the ability to run in an uninstalled copy of the INDEL_ROOT (see
          r2476): file-system ancestors are now also taken into account when
          locating a base resource for the top-level resource.

        2634, 2008-03-04 14:12:28 +0100 (Di, 04 Mrz 2008), walther
        + User-defined pages in the variables panel are now saved and restored,
          and the groundwork for resource-defined pages is laid.

        2635, 2008-03-04 16:13:20 +0100 (Di, 04 Mrz 2008), walther
        + Resources can provide variable pages using the "VariablePages" key in
          resource.prp.

        2644, 2008-03-06 09:24:23 +0100 (Do, 06 Mrz 2008), walther
        ! Change the argument number error in INIXApp.ResourceStart into a warning
          so that the places where it is misused for Python.Services.ExecuteFromInco
          continue to work after libinix r2643.

        2699, 2008-03-26 13:06:07 +0100 (Mi, 26 Mrz 2008), walther
        + Output from external commands now appears in the status bar rather than
          an outwin resource.

        2763, 2008-04-10 12:39:05 +0200 (Do, 10 Apr 2008), stalder
        + Add new entry in properties for a list of called external binaries

        2792, 2008-04-11 09:09:11 +0200 (Fr, 11 Apr 2008), walther
        + Added functions and constants for status bar operations.

        2817, 2008-04-15 17:32:52 +0200 (Di, 15 Apr 2008), walther
        ! Removed the obsolete resize buttons from the work place header.
        ! Save and restore the size of the message history.

        2822, 2008-04-16 17:01:06 +0200 (Mi, 16 Apr 2008), walther
        + Shift-clicking on the menu item of a resource that is already displayed
          now opens an additional instance of the resource. Additional resources
          that are displayed at the time the application is quit are saved and
          restored at the next launch.

        2823, 2008-04-16 17:17:01 +0200 (Mi, 16 Apr 2008), walther
        + Provisional: mark resources that are currently displayed in the menu.

        2830, 2008-04-18 08:55:45 +0200 (Fr, 18 Apr 2008), walther
        ! Fixed an AttributeError at shutdown that could prevent resource properties
          from being saved (since r2822).

        2842, 2008-04-22 10:59:33 +0200 (Di, 22 Apr 2008), walther
        ! Fixed #211 (together with libinix r2841): Save and restore maximization
          of the window (and, if it is maximized, its unmaximized size).

        2844, 2008-04-24 11:58:04 +0200 (Do, 24 Apr 2008), walther
        ! Moved invocation of OnDidEnter after display of default subresources, to
          fix duplication of a default subresource if it was already displayed from
          an OnDidEnter method of an ancestor.
        ! Bring the menu and work place selection into a consistent state after a
          call to Display() that undisplayed other resources.

        2849, 2008-04-25 14:43:09 +0200 (Fr, 25 Apr 2008), walther
        + Fixed #79: Resources can now have an icon, the one of the top-level
          resource is used for the INIXApp window.

        2858, 2008-04-29 16:21:43 +0200 (Di, 29 Apr 2008), walther
        ! Only make commands menu OnExpand actions synchronous when needed, to
          escape one particular type of deadlock between main thread and Python
          thread (together with menu r2859).

        2861, 2008-04-29 16:54:32 +0200 (Di, 29 Apr 2008), walther
        + Make resource menu items explicitly expandable to make better use of the
          space in the menu.

        3060, 2008-07-04 17:07:57 +0200 (Fr, 04 Jul 2008), walther
        + Added method INIXApp.ResourceInstance.GetPrefsFolder() to allow
          resources to store arbitrary preferences files.

        3067, 2008-07-07 17:30:39 +0200 (Mo, 07 Jul 2008), walther
        ! Allow longer strings in persistent page properties.

        3116, 2008-08-11 07:54:40 +0200 (Mo, 11 Aug 2008), walther
        + Fixed #341: Showing the left and right menus now extends the window
          size, similar to drawers on Mac OS, so that the size of the work place
          stays constant. Windows near the edges of the screen are handled
          gracefully. Known problem still being worked on: plugins with
          irreversible resizing behavior, such as explorer and memdump, are not
          left invariant because for a short moment the work place still changes
          its size.

        3117, 2008-08-11 11:39:25 +0200 (Mo, 11 Aug 2008), walther
        ! Catch exceptions when calling into user code (OnDidEnter etc.) so that
          they don't stop the whole script.

        3148, 2008-08-20 15:36:12 +0200 (Mi, 20 Aug 2008), walther
        ! Don't show all user commands initially, then hide the ones that don't
          belong to the current target, as that can cause several seconds of
          visible stir in the menu if there are many. Adding hidden, then showing
          is virtually instantaneous.

        3188, 2008-09-09 15:15:18 +0200 (Di, 09 Sep 2008), walther
        + Added ResourceInstance.Select method that displays the resource if
          necessary and selects its work place.

        3262, 2008-12-09 11:07:22 +0100 (Di, 09 Dez 2008), walther
        ! Fixed: Editing the action of a user command that has a keyboard
          equivalent would leave the action of the keyboard equivalent unmodified.

        3264, 2008-12-09 14:11:14 +0100 (Di, 09 Dez 2008), walther
        ! Fixed: After deleting a user command with a keyboard equivalent, that
          keyboard equivalent could not be assigned to a different user command.

        3583, 2009-06-19 17:13:59 +0200 (Fr, 19 Jun 2009), walther
        + Added the capability of displaying icons in command menu items (part of
          issue #619).

        3587, 2009-06-22 14:29:40 +0200 (Mo, 22 Jun 2009), walther
        + Fixed #618: Save and restore expanded command menus when leaving and
          entering resources.

        3637, 2009-07-23 15:09:28 +0200 (Do, 23 Jul 2009), walther
        + Display the target name in the window title.

        3639, 2009-08-10 16:14:42 +0200 (Mo, 10 Aug 2009), walther
        ! Gracefully deal with nonexistent PageDefaults variables (and print a
          warning) instead of leaving the application in an inconsistent state.
          (Can happen with mismatches between resource and plugin versions during
          development).

        3665, 2009-08-27 12:23:37 +0200 (Do, 27 Aug 2009), walther
        ! INIXApp.ResourceInstance.Remove() must also remove subresources, otherwise
          the application is left in an inconsistent state.

        3666, 2009-08-27 15:04:09 +0200 (Do, 27 Aug 2009), walther
        ! Keep track of removed resources and ignore calls to them via
          callresourcemethod.py. Such calls are often unavoidable due to the
          asynchronous and sequential operation of the Python thread and usually
          safe to ignore.
        ! r3665, second try. (How many times does the old remove-item-from-list-
          while-iterating-over-it problem have to trip me up?)

        3847, 2009-12-15 16:36:45 +0100 (Di, 15 Dez 2009), walther
        ! Removed limitation of PageDefaults strings to 1020 bytes.

        3854, 2009-12-16 11:31:13 +0100 (Mi, 16 Dez 2009), walther
        ! Fixed Python errors when displaying deeply nested subresources -
          comparing INCO strings as doubles happened to work in the usual cases,
          but was clearly not what was intended.

        4003, 2010-03-01 16:06:29 +0100 (Mo, 01 Mrz 2010), walther
        + Use the title of the top-level resource for the pinned taskbar button.

        4322, 2010-07-12 16:55:45 +0200 (Mo, 12 Jul 2010), walther
        ! Merged branches/INIXMLApp.

        4516, 2010-09-10 14:58:40 +0200 (Fr, 10 Sep 2010), walther
        + Rewritten target selection menu: - It is now possible to select
          subtargets without having to open the menu twice: click on the
          disclosure triangle on a target to reveal its subtargets. - Resources
          can now restrict what targets are displayed in the menu by overriding
          INIXApp.ResourceInstance.GetTargets.

        4520, 2010-09-10 16:44:12 +0200 (Fr, 10 Sep 2010), walther
        ! Properly display target names containing '.' in the target menu.
        ! Ignore more communication errors when trying to fetch subtargets.

        4523, 2010-09-13 14:41:24 +0200 (Mo, 13 Sep 2010), walther
        ! Fixed #898: By default, automatically select a target configured at the
          INCOServer on the first start (or when no saved state is available).
          Resources can override with their preferred choice.

        4534, 2010-09-21 17:05:44 +0200 (Di, 21 Sep 2010), walther
        ! Fixed window size restoration of resources with no subresources, broken
          in r4530.

        4577, 2010-10-08 11:44:45 +0200 (Fri, 08 Oct 2010), walther
        ! Fixed #599: Respect a target set on the command line rather than
          overwriting it with the saved state.

        4702, 2010-12-06 10:14:49 +0100 (Mo, 06 Dez 2010), zulliger
        ! Fixed INIXApp failures with newer Python versions: There's a built-in
          module named "select" now. It conflicted with our select.py. Therefore,
          select.py became menuselect.py

        4767, 2011-02-11 15:54:54 +0100 (Fr, 11 Feb 2011), walther
        ! Fixed (harmless) Python error when selecting a new resource and then
          expanding a menu of the old resource while the Python thread is busy.

        5069, 2011-12-09 11:30:16 +0100 (Fri, 09 Dec 2011), walther
        + Let resources optionally specify a different (longer) title for the
          window title.

        6160, 2014-07-25 09:08:58 +0200 (Fr, 25 Jul 2014), walther
        + Add OnDidPreload method that allows resource instances to react to their
          preloading. (Required for issue #1700)

        7089, 2019-02-20 10:12:29Z, walther
        ! Fix #594: Disable the keyboard equivalents of user commands that are
          hidden because their "only show for target" property does not match the
          current target. This also allows using the same keyboard equivalent on
          multiple user commands as long as they are not visible together. (When
          they are, the last one wins.)

        7126, 2019-05-09 14:21:36Z, walther
        + Fixed #2529: Add draggable splitters to adjust the width of the left and
          right menus.

        7161, 2019-08-13 07:40:02Z, walther
        ! Fix #589: Accept drops onto existing user commands to replace their
          title and action (requires menu r7160).

        7265, 2020-02-06 13:06:13Z, walther
        + Remember the expansion state of the "Nearby Targets" menu. Depending on
          the number of items in the targets menu, items coming and going within
          it may cause other items to jump around annoyingly, so allow users to
          keep it closed.

        7395, 2020-05-20 10:20:15Z, walther
        ! Also consider URLMasters when looking for an initial target.

        8110, 2022-11-30 16:19:01Z, walther
        ! Update to Python 3, pass 1: Mechanical changes by 2to3, plus manual
          adjustments to stay compatible with 2.7. Not sufficient to run on 3 yet.
        ! Move added open() call to with statement.
        ! Derive class from object so that the check "isinstance(..., type)" works.

        8131, 2022-12-13 15:41:46Z, walther
        ! Update to Python 3, pass 2: Works on 3 now, still compatible with 2.7.
        ! Fix calling of unbound methods.

        $LastChangedRevision$ $iDate$ $Author$
        ! Use Get/PutVariableEx for 64bit types to not lose precision. The normal
          variable functions convert to double and therefore can lose bits.

        $Comment$

        + = new feature
        ! = change, bugfix
        - = removed
Remarks
        project                 : INIXApp
        language                : Python
        system                  : any

Generated by doxygen 1.8.8