Package gui :: Module misc
[hide private]
[frames] | no frames]

Module misc

source code

Miscellaneous functions used throughout the GUI.

Functions [hide private]
wx.BoxSizer instance
add_border(box, border=0, packing=8, debug=False)
Create the main part of the frame, returning the central sizer.
source code
wx.Bitmap instance
bitmap_setup(path)
Build and return the bitmap, handling transparency for all operating systems.
source code
str
format_table(table)
Format the text by stripping whitespace.
source code
 
open_file(file, force_text=False)
Open the file in the platform's native editor/viewer.
source code
bool
protected_exec(fn, *args, **kargs)
Apply the given function, catching all RelaxErrors.
source code
str
table_line(text=None, widths=None, bottom=False)
Format a line of a table.
source code
Variables [hide private]
  status = Status()
  __package__ = 'gui'

Imports: deepcopy, os, platform, sys, wrap, wx, gui_raise, AllRelaxErrors, Status


Function Details [hide private]

add_border(box, border=0, packing=8, debug=False)

source code 

Create the main part of the frame, returning the central sizer.

Parameters:
  • box (wx.BoxSizer instance) - The box sizer element to pack the borders into.
  • border (int) - The size of the border in pixels.
  • packing (wx.VERTICAL or wx.HORIZONTAL) - Specify if the central sizer should be vertically or horizontally packed.
  • debug (bool) - A flag which if true will make colourful borders.
Returns: wx.BoxSizer instance
The central sizer.

bitmap_setup(path)

source code 

Build and return the bitmap, handling transparency for all operating systems.

This function is required to handle alpha in bitmap on MS Windows so that regions with partial transparency are not blended into the default dark grey colour of Windows' windows.

Parameters:
  • path (str) - The absolute path to the bitmap image.
Returns: wx.Bitmap instance
The processed bitmap object.

format_table(table)

source code 

Format the text by stripping whitespace.

Parameters:
  • table (lists of lists of str) - The table.
Returns: str
The formatted table.

open_file(file, force_text=False)

source code 

Open the file in the platform's native editor/viewer.

Parameters:
  • file (str) - The path of the file to open.
  • force_text (bool) - A flag which if True will cause a text editor to be launched.

protected_exec(fn, *args, **kargs)

source code 

Apply the given function, catching all RelaxErrors.

All args and keyword args supplied will be directly applied to the given function.

Parameters:
  • fn (func) - The function to apply.
Returns: bool
The status of execution.

table_line(text=None, widths=None, bottom=False)

source code 

Format a line of a table.

Parameters:
  • text (list of str or None) - The list of table elements. If not given, an empty line will be be produced.
  • widths (list of int) - The list of column widths for the table.
  • botton - A flag which if True will cause a table bottom line to be produced.
  • bottom (bool)
Returns: str
The table line.