pycrossword  0.4
Pure-Python implementation of a crossword puzzle generator and editor
Classes | Namespaces | Functions | Variables
utils.py File Reference

Classes

class  pycross.utils.utils.QThreadStump
 Customized thread class (based on QThread) that adds progress, error etc. More...
 
class  pycross.utils.utils.TaskSignals
 
class  pycross.utils.utils.Task
 
class  pycross.utils.utils.JsonHiliter
 Syntax highlighter class for JSON. More...
 

Namespaces

 pycross.utils.utils
 
 utils.utils
 General container for utility functions and classes used across the entire application.
 

Functions

def pycross.utils.utils.is_iterable (obj)
 Checks if a given object is iterable (i.e. More...
 
def pycross.utils.utils.getosname ()
 Gets the current OS (platform) name. More...
 
def pycross.utils.utils.generate_uuid ()
 Generates a random UUID (alphanumeric string). More...
 
def pycross.utils.utils.copy_file (path_from, path_to)
 Copies a file into another location. More...
 
def pycross.utils.utils.walk_dir (root_path, abs_path=True, recurse=True, dir_process_function=None, file_process_function=None, file_types=None)
 Iterates the files and folder in a given folder, performing some operations on the found files / folders. More...
 
def pycross.utils.utils.run_exe (args, external=False, capture_output=True, stdout=subprocess.PIPE, encoding=ENCODING, timeout=None, shell=False, **kwargs)
 Runs an executable and optionally returns the result. More...
 
def pycross.utils.utils.datetime_to_str (dt=None, strformat='%Y-%m-%d %H-%M-%S')
 Converts a Python datetime object to a string. More...
 
def pycross.utils.utils.timestamp_to_str (ts=None, strformat='%Y-%m-%d %H-%M-%S')
 Converts a timestamp (Unix time) to a string. More...
 
def pycross.utils.utils.str_to_datetime (text, strformat='%Y-%m-%d %H-%M-%S')
 Converts a string to a Python datetime object. More...
 
def pycross.utils.utils.str_to_timestamp (text, strformat='%Y-%m-%d %H-%M-%S')
 Converts a string to a timestamp (Unix time). More...
 
def pycross.utils.utils.get_tempdir ()
 Gets the path to the Temp directory on the system. More...
 
def pycross.utils.utils.bytes_human (value, suffix='B')
 Returns a human-formatted file size as a string, e.g. More...
 
def pycross.utils.utils.restart_app (closefunction)
 Restarts this app. More...
 
def pycross.utils.utils.file_types_registered (filetypes=('xpf', 'ipuz', 'pxjson'))
 Checks if the given file type associations are registered in the OS. More...
 
def pycross.utils.utils.register_file_types (filetypes=('xpf', 'ipuz', 'pxjson'), register=True)
 Registers file associations in the current OS for the given file types and application. More...
 
def pycross.utils.utils.pluggable (category)
 Plugin decorator for custom plugins. More...
 
def pycross.utils.utils.collect_pluggables (parent_object, indent=' ')
 Collects the names and signatures of wrapped methods from a class instance. More...
 
def pycross.utils.utils.get_builtins ()
 Collects the names and signatures of builtin Python functions. More...
 
def pycross.utils.utils.get_script_members (script)
 Retrieves the names of all variables in the given Python script. More...
 
def pycross.utils.utils.make_font (family, size=-1, weight=-1, italic=False, font_unit='pt')
 Constructs a QtGui.QFont object from given font parameters. More...
 
def pycross.utils.utils.MsgBox (what, parent=None, title='pyCross', msgtype='info', btn=None, detailedText='', infoText='', execnow=True)
 Displays a GUI message dialog and returns the user's reply. More...
 
def pycross.utils.utils.UserInput (dialogtype='text', parent=None, title='pyCross', label='', value=None, textmode='normal', valrange=None, decimals=1, step=1, comboeditable=True, comboitems=[])
 Displays a GUI user input dialog and returns the user's input. More...
 
def pycross.utils.utils.clipboard_copy (value, valtype='text')
 Copies a given value / object to the system clipboard. More...
 
def pycross.utils.utils.clipboard_get (valtype='text')
 Retrieves the contents of the system clipboard. More...
 
def pycross.utils.utils.clipboard_clear ()
 Clears the system clipboard. More...
 
def pycross.utils.utils.stylesheet_load (style, dequote=True, strip_sz=True, units=('pt', 'px'))
 Returns a Qt widget's stylesheet as a Python dictionary. More...
 
def pycross.utils.utils.stylesheet_dump (d, quoted_keys=('font-family',), add_units={ 'font-size':'pt', 'border':'px', 'border-width':'px'})
 Serializes a Python dictionary representing a widget's style sheet into a string. More...
 
def pycross.utils.utils.font_weight_css2qt (weight, default=0)
 Converts CSS font weight constants to Qt font weight constants. More...
 
def pycross.utils.utils.font_weight_qt2css (weight, default=0)
 Converts Qt font weight constants to CSS font weight constants. More...
 
def pycross.utils.utils.font_from_stylesheet (style, font_unit='pt', default_font=None)
 Constructs a Qt font object (QtGui.QFont) from a Qt style sheet string. More...
 
def pycross.utils.utils.font_to_stylesheet (font, style, font_unit='pt')
 Stores a give Qt font in a style sheet string and returns the modified style sheet. More...
 
def pycross.utils.utils.color_from_stylesheet (style, tag='background-color', default='black')
 Returns a Qt color object from a Qt style sheet string. More...
 
def pycross.utils.utils.color_to_stylesheet (color, style, tag='background-color')
 Stores a Qt color object in a style sheet string and returns the modified style sheet. More...
 
def pycross.utils.utils.property_to_stylesheet (propname, propvalue, style)
 Stores a property (attribute) in a style sheet string and returns the modified style sheet. More...
 
def pycross.utils.utils.property_from_stylesheet (propname, style, default=None)
 Reads a property from a style sheet string and returns its value. More...
 

Variables

dictionary pycross.utils.utils.MSGBOX_BUTTONS
 Button names, their localized names and roles used in MsgBox() function. More...
 
dictionary pycross.utils.utils.MSGBOX_TYPES
 Types of MsgBox dialogs used in MsgBox() function. More...