asn1editor.wxPython package

Submodules

asn1editor.wxPython.Environment module

asn1editor.wxPython.Environment.load()
asn1editor.wxPython.Environment.log_error(log_message: str)
asn1editor.wxPython.Environment.save()

asn1editor.wxPython.FilePickerHandler module

class asn1editor.wxPython.FilePickerHandler.FilePickerHandler(file_dialog_factory: Callable, propagator: Callable | None, overwrite_question: bool = False)

Bases: object

file_selected(filename: str | List[str], window: Window)
on_menu_click(e: Event)

asn1editor.wxPython.ImageList module

class asn1editor.wxPython.ImageList.ImageList

Bases: object

add_bitmap(bitmap: Bitmap, name: str)
get_bitmap(name: str) Bitmap | None
get_image_list() ImageList
get_index(name: str) int

asn1editor.wxPython.MainWindow module

class asn1editor.wxPython.MainWindow.MainWindow(plugins: List[Plugin] | None = None, type_augmenter: TypeAugmenter | None = None, title='ASN.1 editor 0.8.0', enable_load_last=True)

Bases: Frame, PluginInterface

choice_entry(message: str, caption: str, choices: List[str], default: str | None = None) str | None

Queries the user for a choice of values.

@param message: Message to show to the user @param caption: Message box caption @param choices: List of strings for the user to choose from @param default: Default selection

@return: Selected string, None if cancelled

close(e: Event)
dir_picker(message: str) str | None

Opens a dir picker where the user can choose a directory name and returns this chosen name.

@param message: Message to show in the dir picker

@return: Selected directory, None if cancelled

encode_data(codec: str) bytes

Encodes the data currently edited in the editor window with an ASN.1 codec.

@param codec: Codec to use for encoding (reference asn1tools which ones are supported)

@return: Encoded data

file_picker(message: str, wildcard: str, open_: bool) str | None

Opens a file picker where the user can choose a file name and returns this chosen name.

@param message: Message to show in the file picker @param wildcard: Wildcards to offer the user in order to help him choose the correct file types @param open_: Flag if the dialog shall be an open dialog (True) or a save dialog (false)

@return: Selected file, None if cancelled

get_settings() dict

Get a settings dictionary for a plugin to store persistent data

@return: Settings dict

get_spec(codec: str)

@param codec: Codec to use (reference asn1tools which ones are supported)

@return: The compiled ASN.1 specification as an object defined by asn1tools.

get_spec_filename() str

@return: The file name of the ASN.1 specification file currently loaded.

get_typename() str

@return: The name of the currently used type name in the editor.

load_data_from_file(file_name: str)
load_spec(file_name: str | None, type_name: str | None = None) bool

Loads an ASN.1 specification in the editor.

@param file_name: File name of the ASN.1 specification @param type_name: Optional type name indication. Format: [Module name].[Type name]

@return: True if data was loaded successfully

save_data_to_file(file_name: str)
select_view_and_tag_info(view: ViewType, tag_info: TagInfo)
show_data(data: bytes, codec: str)

Decodes and shows data from an ASN.1 encoded byte stream in the editor.

@param data: Byte stream with ASN.1 encoded data @param codec: Codec to use for decoding (reference asn1tools which ones are supported)

show_message(message: str, caption: str, message_type: MessageType) bool

Shows a status message.

@param message: Message to show to the user @param caption: Message box caption @param message_type: Type of message box

@return: If type is a question, True means yes and False means No

show_progress(message: str, caption: str, max_progress: int | None = None)

Shows a progress window

@param message: Message to show to the user @param caption: Message box caption @param max_progress: Maximum progress value

show_status(message: str)

Shows a status message.

@param message: Message to show to the user

text_entry(message: str, default: str | None = None) str | None

Queries a text from the user.

@param message: Message to show to the user @param default: Default value for the text entry

@return: Entered text, None if cancelled

update_progress(message: str | None = None, close: bool = False, progress: int | None = None) bool

Updates a shown progress window

@param message: Updated message to show to the user, optional @param close: If set, window is closed, optional @param progress: Progress to show, if none, an indeterminate process is shown, optional

@return: False if progress window has been canceled, otherwise True

asn1editor.wxPython.MenuHandler module

class asn1editor.wxPython.MenuHandler.MenuHandler(frame: Frame, plugins: List[Plugin] | None, about_box_content: str)

Bases: object

add_recent(filename: str, typename: str)
build(load_spec: Callable, load_data_from_file: Callable, save_data_to_file: Callable, view_changed: Callable)
enable(enable: bool = True)
property load_last: bool
property recent: List[List[str]]

asn1editor.wxPython.Resources module

asn1editor.wxPython.Resources.get_bitmap_from_svg(bitmap_name) Bitmap
asn1editor.wxPython.Resources.plugin_resource_path(relative_path: str) str

Get absolute path to resource required for PyInstaller/py2exe

asn1editor.wxPython.Resources.resource_path(relative_path: str) str

Get absolute path to resource required for PyInstaller/py2exe

asn1editor.wxPython.SingleFileDropTarget module

class asn1editor.wxPython.SingleFileDropTarget.SingleFileDropTarget(callback: Callable)

Bases: FileDropTarget

OnDropFiles(x, y, filenames) bool

Override this function to receive dropped files.

asn1editor.wxPython.Styler module

asn1editor.wxPython.TreeView module

class asn1editor.wxPython.TreeView.TreeView(window: Window, content_window: ScrolledWindow, root_name: str, labels: Labels)

Bases: object

destroy()
get_ctrl(root_view: WxPythonView) TreeCtrl
hide()
item_right_clicked(e: TreeEvent)
item_selected(e: TreeEvent)
item_tooltip(e: TreeEvent)

asn1editor.wxPython.ViewSelect module

class asn1editor.wxPython.ViewSelect.RadioHandler(names_and_values: List[Tuple[str, int]])

Bases: object

append_menu_items(menu: Menu, default: Enum)
bind(frame: Frame, callback: Callable)
property value: int
class asn1editor.wxPython.ViewSelect.TagInfo(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

LABELS = 1
TOOLTIPS = 0
class asn1editor.wxPython.ViewSelect.ViewSelect(frame: Frame, change_callback: Callable)

Bases: object

get_menu() Menu
property tag_info: TagInfo
property view_type: ViewType
class asn1editor.wxPython.ViewSelect.ViewType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

GROUPS = 2
TREE = 3

asn1editor.wxPython.WxPythonComplexViews module

asn1editor.wxPython.WxPythonViewFactory module

class asn1editor.wxPython.WxPythonViewFactory.WxPythonViewFactory(window: ScrolledWindow, labels: Labels)

Bases: AbstractViewFactory

get_bitstring_view(type_info: TypeInfo, number_of_bits: int, named_bits: List[Tuple[str, int]]) Tuple[AbstractView, BitstringInterface, OptionalInterface]
get_boolean_view(type_info: TypeInfo) Tuple[AbstractView, ValueInterface, OptionalInterface]
get_choice_view(type_info: TypeInfo, choices: List[str]) Tuple[ChoiceView, ValueInterface, OptionalInterface]
get_container_view(type_info: TypeInfo) Tuple[ContainerView, OptionalInterface]
get_date_view(type_info: TypeInfo) Tuple[AbstractView, ValueInterface, OptionalInterface]
get_datetime_view(type_info: TypeInfo) Tuple[AbstractView, ValueInterface, OptionalInterface]
get_enumerated_view(type_info: TypeInfo, choices: List[str]) Tuple[AbstractView, ValueInterface, OptionalInterface]
get_hex_string_view(type_info: TypeInfo, minimum: int | None, maximum: int | None)
get_list_view(type_info: TypeInfo, minimum: int, maximum: int) Tuple[ListView, ValueInterface, OptionalInterface]
get_number_view(type_info: TypeInfo, minimum: int | float | None, maximum: int | float | None, float_: bool) Tuple[AbstractView, ValueInterface, OptionalInterface]
get_string_view(type_info: TypeInfo, minimum: int | None, maximum: int | None)
get_text_view(type_info: TypeInfo, text: str) AbstractView
get_time_view(type_info: TypeInfo) Tuple[AbstractView, ValueInterface, OptionalInterface]

asn1editor.wxPython.WxPythonViews module

Module contents

class asn1editor.wxPython.MainWindow(plugins: List[Plugin] | None = None, type_augmenter: TypeAugmenter | None = None, title='ASN.1 editor 0.8.0', enable_load_last=True)

Bases: Frame, PluginInterface

choice_entry(message: str, caption: str, choices: List[str], default: str | None = None) str | None

Queries the user for a choice of values.

@param message: Message to show to the user @param caption: Message box caption @param choices: List of strings for the user to choose from @param default: Default selection

@return: Selected string, None if cancelled

close(e: Event)
dir_picker(message: str) str | None

Opens a dir picker where the user can choose a directory name and returns this chosen name.

@param message: Message to show in the dir picker

@return: Selected directory, None if cancelled

encode_data(codec: str) bytes

Encodes the data currently edited in the editor window with an ASN.1 codec.

@param codec: Codec to use for encoding (reference asn1tools which ones are supported)

@return: Encoded data

file_picker(message: str, wildcard: str, open_: bool) str | None

Opens a file picker where the user can choose a file name and returns this chosen name.

@param message: Message to show in the file picker @param wildcard: Wildcards to offer the user in order to help him choose the correct file types @param open_: Flag if the dialog shall be an open dialog (True) or a save dialog (false)

@return: Selected file, None if cancelled

get_settings() dict

Get a settings dictionary for a plugin to store persistent data

@return: Settings dict

get_spec(codec: str)

@param codec: Codec to use (reference asn1tools which ones are supported)

@return: The compiled ASN.1 specification as an object defined by asn1tools.

get_spec_filename() str

@return: The file name of the ASN.1 specification file currently loaded.

get_typename() str

@return: The name of the currently used type name in the editor.

load_data_from_file(file_name: str)
load_spec(file_name: str | None, type_name: str | None = None) bool

Loads an ASN.1 specification in the editor.

@param file_name: File name of the ASN.1 specification @param type_name: Optional type name indication. Format: [Module name].[Type name]

@return: True if data was loaded successfully

save_data_to_file(file_name: str)
select_view_and_tag_info(view: ViewType, tag_info: TagInfo)
show_data(data: bytes, codec: str)

Decodes and shows data from an ASN.1 encoded byte stream in the editor.

@param data: Byte stream with ASN.1 encoded data @param codec: Codec to use for decoding (reference asn1tools which ones are supported)

show_message(message: str, caption: str, message_type: MessageType) bool

Shows a status message.

@param message: Message to show to the user @param caption: Message box caption @param message_type: Type of message box

@return: If type is a question, True means yes and False means No

show_progress(message: str, caption: str, max_progress: int | None = None)

Shows a progress window

@param message: Message to show to the user @param caption: Message box caption @param max_progress: Maximum progress value

show_status(message: str)

Shows a status message.

@param message: Message to show to the user

text_entry(message: str, default: str | None = None) str | None

Queries a text from the user.

@param message: Message to show to the user @param default: Default value for the text entry

@return: Entered text, None if cancelled

update_progress(message: str | None = None, close: bool = False, progress: int | None = None) bool

Updates a shown progress window

@param message: Updated message to show to the user, optional @param close: If set, window is closed, optional @param progress: Progress to show, if none, an indeterminate process is shown, optional

@return: False if progress window has been canceled, otherwise True