diff --git a/python/incendium/gui.py b/python/incendium/gui.py index b635e2a..688b57f 100644 --- a/python/incendium/gui.py +++ b/python/incendium/gui.py @@ -116,7 +116,12 @@ def info(message, title, detail=None): else: msg = '\n'.join([system.util.translate(message), system.util.translate(detail)]) - system.gui.messageBox(msg, system.util.translate(title)) + JOptionPane.showMessageDialog( + None, + msg, + system.util.translate(title), + JOptionPane.INFORMATION_MESSAGE + ) def warning(message, title, detail=None): diff --git a/python/java/__init__.py b/python/java/__init__.py deleted file mode 100644 index c0d2dd6..0000000 --- a/python/java/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (C) 2019 -# Author: Cesar Roman -# Contact: thecesrom@gmail.com - -"""Java package.""" diff --git a/python/java/lang.py b/python/java/lang.py deleted file mode 100644 index af799db..0000000 --- a/python/java/lang.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2019 -# Author: Cesar Roman -# Contact: thecesrom@gmail.com - -"""Provides classes that are fundamental to the design of the Java -programming language.""" - -__all__ = [ - 'Exception', - 'System' -] - - -class Exception(object): - """The class Exception and its subclasses are a form of Throwable - that indicates conditions that a reasonable application might want - to catch. - - The class Exception and any subclasses that are not also subclasses - of RuntimeException are checked exceptions. Checked exceptions need - to be declared in a method or constructor's throws clause if they - can be thrown by the execution of the method or constructor and - propagate outside the method or constructor boundary. - """ - - # Static elements - cause = '' - - def getCause(self): - """Returns the cause of this throwable or null if the cause is - nonexistent or unknown. (The cause is the throwable that - caused this throwable to get thrown.) - - Returns: - str: The cause of this throwable or null if the cause is - nonexistent or unknown. - """ - return self.cause - - -class System(object): - """The System class contains several useful class fields and - methods. It cannot be instantiated. - - Among the facilities provided by the System class are standard - input, standard output, and error output streams; access to - externally defined properties and environment variables; a means - of loading files and libraries; and a utility method for quickly - copying a portion of an array. - """ - - @staticmethod - def currentTimeMillis(): - """Returns the current time in milliseconds. Note that while - the unit of time of the return value is a millisecond, the - granularity of the value depends on the underlying operating - system and may be larger. For example, many operating systems - measure time in units of tens of milliseconds. - - Returns: - long: The difference, measured in milliseconds, between - the current time and midnight, January 1, 1970 UTC. - """ - import system.date - return system.date.toMillis(system.date.now()) diff --git a/python/java/util.py b/python/java/util.py deleted file mode 100644 index 77cb6a1..0000000 --- a/python/java/util.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2019 -# Author: Cesar Roman -# Contact: thecesrom@gmail.com - -"""Contains the collections framework, legacy collection classes, -event model, date and time facilities, internationalization, and -miscellaneous utility classes (a string tokenizer, a random-number -generator, and a bit array).""" - -__all__ = [ - 'Date', - 'Locale' -] - - -class Date(object): - """The class Date represents a specific instant in time, with - millisecond precision. - """ - - def __new__(cls, date=None): - """Allocates a Date object and initializes it... - - 1) so that it represents the time at which it was allocated, - measured to the nearest millisecond. - - 2) to represent the specified number of milliseconds since the - standard base time known as "the epoch", namely January 1, - 1970, 00:00:00 GMT. - - 1) java.util.Date() - 2) java.util.Date(date) - - Args: - date (long): The milliseconds since January 1, 1970, - 00:00:00 GMT. Optional. - - Returns: - datetime: A new Date instance. - """ - import system.date - if date is None: - self = system.date.now() - else: - self = system.date.fromMillis(date) - return self - - -class Locale(object): - """A Locale object represents a specific geographical, political, - or cultural region. An operation that requires a Locale to perform - its task is called locale-sensitive and uses the Locale to tailor - information for the user. For example, displaying a number is a - locale-sensitive operation; the number should be formatted - according to the customs and conventions of the user's native - country, region, or culture. - """ - - def __init__(self, - language, - country=None, - variant=None): - """Locale initializer. - - Args: - language (str): Language code. - country (str): Country code. - variant (str): Variant code. - """ - self.language = language - self.country = country - self.variant = variant - - @property - def English(self): - return self.__init__('eng') diff --git a/python/javax/__init__.py b/python/javax/__init__.py deleted file mode 100644 index ee2e652..0000000 --- a/python/javax/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (C) 2019 -# Author: Cesar Roman -# Contact: thecesrom@gmail.com - -"""Package of standard Java extensions.""" diff --git a/python/javax/swing.py b/python/javax/swing.py deleted file mode 100644 index 2949065..0000000 --- a/python/javax/swing.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (C) 2019 -# Author: Cesar Roman -# Contact: thecesrom@gmail.com - -"""Provides a set of "lightweight" (all-Java language) components -that, to the maximum degree possible, work the same on all platforms.""" - -__all__ = [ - 'JOptionPane' -] - - -class JOptionPane(object): - """JOptionPane makes it easy to pop up a standard dialog box that - prompts users for a value or informs them of something. For - information about using JOptionPane, see How to Make Dialogs, a - section in The Java Tutorial. - """ - # messageType. - ERROR_MESSAGE = 0 - INFORMATION_MESSAGE = 1 - WARNING_MESSAGE = 2 - QUESTION_MESSAGE = 3 - PLAIN_MESSAGE = -1 - - # optionType. - DEFAULT_OPTION = -1 - YES_NO_OPTION = 0 - YES_NO_CANCEL_OPTION = 1 - OK_CANCEL_OPTION = 2 - - # When one of the showXxxDialog methods returns an integer, the - # possible values are: - YES_OPTION = 0 - NO_OPTION = 1 - CANCEL_OPTION = 2 - OK_OPTION = 0 - CLOSED_OPTION = -1 - - @staticmethod - def showConfirmDialog(parentComponent, message, title=None, - optionType=None, messageType=None, icon=None): - """Asks a confirming question, like yes/no/cancel. - - Args: - parentComponent (Component): determines the Frame in which - the dialog is displayed; if None, or if the - parentComponent has no Frame, a default Frame is used. - message (object): The object to display. - title (str): The title string for the dialog. Optional. - optionType (int): An int designating the options available - on the dialog: YES_NO_OPTION, YES_NO_CANCEL_OPTION, - or OK_CANCEL_OPTION. Optional. - messageType (int): An integer designating the kind of - message this is; primarily used to determine the icon - from the pluggable Look and Feel: ERROR_MESSAGE, - INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, - or PLAIN_MESSAGE. Optional. - icon (Icon): The icon to display in the dialog. Optional. - Returns: - int: An integer indicating the option selected by the user. - """ - print(parentComponent, message, title, optionType, messageType, icon) - return JOptionPane.YES_OPTION - - @staticmethod - def showInputDialog(parentComponent, message, title=None, - messageType=None, icon=None, selectionValues=None, - initialSelectionValue=None): - """Prompt for some input. - - Args: - parentComponent (Component): determines the Frame in which - the dialog is displayed; if None, or if the - parentComponent has no Frame, a default Frame is used. - message (object): The object to display. - title (str): The title string for the dialog. Optional. - messageType (int): The type of message to be displayed: - ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, - QUESTION_MESSAGE, or PLAIN_MESSAGE. Optional. - icon (Icon): The icon to display in the dialog. Optional. - selectionValues (list): An array of Objects that gives the - possible selections. Optional. - initialSelectionValue (object): The value used to - initialize the input field. Optional. - Returns: - object: An integer indicating the option selected by the - user. - """ - print(parentComponent, message, title, messageType, icon, - selectionValues, initialSelectionValue) - return 'Input' - - @staticmethod - def showMessageDialog(parentComponent, message, title=None, - messageType=None, icon=None): - """Tell the user about something that has happened. - - Args: - parentComponent (Component): determines the Frame in which - the dialog is displayed; if None, or if the - parentComponent has no Frame, a default Frame is used. - message (object): The object to display. - title (str): The title string for the dialog. Optional. - messageType (int): The type of message to be displayed: - ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, - QUESTION_MESSAGE, or PLAIN_MESSAGE. Optional. - icon (Icon): The icon to display in the dialog. Optional. - """ - print(parentComponent, message, title, messageType, icon) - - @staticmethod - def showOptionDialog(parentComponent, message, title=None, - optionType=None, messageType=None, icon=None, - options=None, initialValue=None): - """The Grand Unification of the above three. - - Args: - parentComponent (Component): determines the Frame in which - the dialog is displayed; if None, or if the - parentComponent has no Frame, a default Frame is used. - message (object): The object to display. - title (str): The title string for the dialog. Optional. - optionType (int): An integer designating the options - available on the dialog: DEFAULT_OPTION, YES_NO_OPTION, - YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION. Optional. - messageType (int): An integer designating the kind of - message this is; primarily used to determine the icon - from the pluggable Look and Feel: ERROR_MESSAGE, - INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, - or PLAIN_MESSAGE. Optional. - icon (Icon): The icon to display in the dialog. Optional. - options (list): An array of objects indicating the possible - choices the user can make; if the objects are - components, they are rendered properly; non-String - objects are rendered using their toString methods; if - this parameter is null, the options are determined by - the Look and Feel. Optional. - initialValue (object): The object that represents the - default selection for the dialog; only meaningful if - options is used; can be null. Optional. - Returns: - int: An integer indicating the option chosen by the user, - or CLOSED_OPTION if the user closed the dialog. - """ - print(parentComponent, message, title, optionType, messageType, - icon, options, initialValue) - return JOptionPane.YES_OPTION