Dynamically extensible development method and system of user interface based on software platform
The interface manager dynamically extracts and inherits the software platform form type information to form a dynamically derived basic form, solving the problem that the existing form cannot be expanded and developed in the existing technology, and achieving efficient and flexible development of the user interface.
Patent Information
- Application Number
- CN202410028558.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-09
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2044-01-09
AI Technical Summary
The existing software platform only allows users to develop by dragging and dropping controls into empty forms, and cannot expand and develop based on existing forms, resulting in a single user interface style, simple controls, and limited functions.
Through the interface manager, the form-related type information in the software platform runtime library is dynamically extracted, and the type information is inherited to form a dynamically derived basic form, and the software platform import code and form dynamic creation code are generated, and the form is stored in the derived code file to realize dynamic expansion and development of existing forms.
The dynamic expansion development of existing forms of the software platform is realized, allowing users to design a highly customized user interface without modifying the platform code, which improves the flexibility and scalability of user interface development.
Smart Images

Figure CN117724719B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle software development, and in particular relates to a method and system for dynamically extensible development of a user interface based on a software platform. Background Art
[0002] Currently, software platforms on the market that can be used for secondary development of user interfaces only allow users to use the empty forms and control lists they provide for development. For example, users drag controls from the list to the empty form, set properties, associate control events, and write event codes to complete extended development. Summary of the invention
[0003] The present invention relates to a method and system for dynamically extensible development of a user interface based on a software platform, wherein the method for dynamically extensible development of a user interface based on a software platform comprises:
[0004] During the operation of the software platform, the interface manager dynamically extracts the type information related to the form in the software platform runtime library, inherits the type information to form a dynamically derived basic form, and generates the software platform import code at the same time; and generates a one-time form dynamic creation code based on the type information in the software platform import code, and stores the software platform import code and the one-time form dynamic creation code in a one-time derived code file.
[0005] In another aspect, the present invention further provides a user interface dynamic extensible development system based on a software platform, comprising:
[0006] The basic dynamic derivation module is configured to dynamically extract the form-related type information in the software platform runtime library through the interface manager during the software platform operation process, and inherit the type information to form a dynamically derived basic form, and the interface manager generates the software platform import code at the same time;
[0007] The derived code acquisition module is configured to generate a code for dynamically creating a form according to the type information in the software platform import code, and store the software platform import code and the code for dynamically creating a form into a derived code file.
[0008] In a third aspect, the present invention further provides a computer-readable storage medium, which is configured to store a program for executing the software platform-based dynamic and extensible user interface development method as described above.
[0009] In a fourth aspect, the present invention further provides a processor configured to execute a program of the software platform-based dynamic and extensible user interface development method as described above.
[0010] In a fifth aspect, the present invention further provides an electronic device, comprising: a processor, a readable storage medium, a communication bus and a communication interface; wherein the processor, the readable storage medium and the communication interface communicate with each other via the communication bus;
[0011] The readable storage medium is used to store a program for executing the above-mentioned method for dynamically extensible development of a user interface based on a software platform, and the processor is configured to execute the program for dynamically extensible development of a user interface based on a software platform.
[0012] In a sixth aspect, the present invention further provides a computer device, comprising: a processor; and
[0013] A readable storage medium and a display module electrically connected to the processor; wherein
[0014] The readable storage medium is used to store a program for executing the aforementioned method for dynamically extensible development of a user interface based on a software platform;
[0015] The processor is configured to execute the program to generate a corresponding user interface;
[0016] The display module is configured to display the user interface.
[0017] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description and the drawings.
[0018] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A step diagram showing a method for dynamically extensible development of a user interface based on a software platform according to some embodiments;
[0021] Figure 2 A schematic diagram showing an interface manager involved in some embodiments;
[0022] Figure 3 A schematic diagram of a dynamically derived basic form after dynamic derivation involved in some embodiments is shown;
[0023] Figure 4 A partial list of controls involved in some embodiments is shown;
[0024] Figure 5 Some items of design window properties involved in some embodiments are shown;
[0025] Figure 6 Some items of control properties involved in some embodiments are shown;
[0026] Figure 7 A graphics display window titled "Graphics 1" according to some embodiments is shown;
[0027] Figure 8 A screenshot image with a target file name of "C:\screenshots\graphics.png" involved in some embodiments is shown;
[0028] Figure 9 A principle block diagram of a software platform-based user interface dynamic and extensible development system according to some embodiments is shown;
[0029] Figure 10 A functional block diagram of an electronic device involved in some embodiments is shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] At present, the software platforms on the market that can be used for secondary development of user interfaces only allow users to use the empty forms and control lists provided by them for development. For example, users drag controls from the list to the empty form by dragging, and set properties, associate control events, and write event codes to complete the extended development. This extension method allows users to only use the empty forms and limited controls provided by the software platform, and cannot be based on the existing forms of the software platform, such as graphics drawing forms and system message forms for extended development; nor can they design a brand new control that does not belong to the control list from scratch. In this way, the extended design of the user interface will be largely limited by the software platform itself, resulting in a single style of the designed user interface, simple controls, and simple functions, and it is impossible to achieve more groundbreaking designs.
[0032] Therefore, at least one embodiment provides a method for dynamically extensible development of a user interface based on a software platform, comprising:
[0033] During the operation of the software platform, the interface manager dynamically extracts the type information related to the form in the software platform runtime library, and inherits the type information to form a dynamically derived basic form. At the same time, the interface manager generates the software platform import code; and generates a one-time form dynamic creation code based on the type information in the software platform import code, and stores the software platform import code and the one-time form dynamic creation code in a one-time derived code file.
[0034] Various non-limiting implementations of the embodiments of the present disclosure are described in detail below in conjunction with the accompanying drawings.
[0035] like Figure 1 As shown, some embodiments provide a method for dynamically extensible development of a user interface based on a software platform, including:
[0036] Step S101, during the operation of the software platform, the interface manager dynamically extracts the type information related to the form in the software platform runtime library, inherits the type information to form a dynamically derived basic form, and generates a software platform import code by the interface manager;
[0037] Step S102, generating a code for dynamically creating a form according to the type information in the software platform import code, and storing the software platform import code and the code for dynamically creating a form in a derived code file.
[0038] In some embodiments, if the attributes and / or call events of the dynamically derived basic form are modified N+1 times by derivation, an N+1 derived code file is created, and the N+1 derived code file includes: N derived code file import code, N+1 form dynamic creation code and / or user code, where N≥1;
[0039] Running the N+1 derived code files forms an N+1 derived user interface.
[0040] In some embodiments, during the operation of the software platform, the method for the interface manager to dynamically extract the type information related to the form in the software platform runtime library includes:
[0041] Import the RTTI unit, that is, before using the RTTI unit, you need to import the system runtime type information (such as `System.Rtti`) unit in the internal implementation code of the software platform to use the classes and methods related to the form in the RTTI unit;
[0042] Use the "Runtime Type Information Context Type" in the system runtime type information unit (such as
[0043] `TRttiContext`) class to create a context object, and then obtain the "runtime type information" (such as `TRttiType`) object of the form through the "get runtime type information type" (such as `GetRttiType`) method; and
[0044] Through the form's "runtime type information" (such as `TRttiType`) object, use the "get property" (such as `GetProperties`) method to obtain the form's property information and use the "get method" (such as
[0045] `GetMethods`) method to get the method information of the form.
[0046] This embodiment realizes dynamic derivation by dynamically extracting the type information related to the form in the software platform runtime during the operation of the software platform, and inheriting the type information to form a dynamically derived basic form. It should be explained that dynamic derivation refers to dynamically extracting the various types of information of the basic form in the runtime environment of the program during the operation of the program, and dynamically creating new form types based on these basic form type information. These new form types are derived from the aforementioned extracted basic form types, and these new form types can be used to create new form objects. Compared with static derivation, dynamic derivation can dynamically create objects, dynamically call methods, dynamically access properties, realize dynamic type conversion and compatibility checks, traverse enumeration and collection types, and customize properties. That is, dynamic derivation can realize more flexible and dynamic programming, making the code more scalable and maintainable. The dynamic extension development method of this embodiment is applied to the user interface development of the software platform, so that the user can extend the existing window of the software platform without modifying the software platform code or calling the compiler to compile the software. The developed window not only has various functions given to the window by the software platform, but is also a dedicated window that is highly customized by the user, which makes the user interface development based on the software platform more efficient and concise.
[0047] Specifically, dynamic extraction refers to the type information of the form (in this embodiment, it refers to the form in the software platform runtime library) dynamically extracted from the runtime environment of the program during the program running. If dynamic extraction is required, the program is required to have an RTTI mechanism. The explanation of the RTTI mechanism is as follows: RTTI (Run-Time Type Information) refers to the mechanism for obtaining relevant type information when the program is running. It allows detailed information about classes, interfaces, methods, properties, etc. to be obtained at runtime, including names, types, access modifiers, etc.
[0048] Specifically, the type information of a form refers to the basic information of the form in the software platform runtime library, such as the form's type name information, parent class information, attribute information, method information, field information, constructor and destructor information, interface information, enumeration information, etc.
[0049] like Figure 2 As shown, the interface manager is used to create, list, design, save, import, export, encrypt, and run user interfaces, thereby achieving comprehensive management of the designed user interfaces.
[0050] The method by which the interface manager dynamically extracts form-related type information from the software platform runtime is as follows:
[0051] By calling the get type function in the context object provided in the "system runtime type information" unit, the form-related type information in the software platform runtime library is obtained.
[0052] The obtained type information is used to further obtain the fields, properties, methods and other information related to the form. The inheritance and derivation methods are as follows:
[0053] Based on the acquired form information, a new derived form type is defined, namely, a dynamically derived basic form, which is used to inherit the form-related type information in the software platform runtime library. That is, the dynamically derived basic form can call the protected and public methods of the form-related type information in the inherited software platform runtime library, read and write its properties, read and write its fields, and so on.
[0054] Based on the defined dynamically derived basic form, the software platform allows the user to add new fields, methods and properties to the dynamically derived basic form and control the behavior of the dynamically derived basic form, thereby realizing the function of dynamically inheriting and deriving a new form based on the type information related to the acquired software platform form.
[0055] The following is a case study to explain in detail how the interface manager dynamically extracts form-related type information in the software platform runtime library and inherits the type information to form a dynamically derived basic form during the software platform operation process:
[0056] Dynamically derive the basic form of the software platform to form a new form type, thereby creating a new form object. The new form object is the dynamically derived basic form. The following steps are required:
[0057] 1. Import the RTTI unit: Before using the RTTI unit, you need to import the `System.Rtti` unit in the internal implementation code of the software platform in order to use the classes and methods related to the basic form in the RTTI unit.
[0058] 2. Get the form type information: Use the `TRttiContext` class to create a context object, and then use the `GetRttiType` method to get the `TRttiType` object of the base form. You can get the corresponding `TRttiType` object by the type name or instance of the base form.
[0059] 3. Extract form properties and methods: Through the `TRttiType` object of the basic form, you can use
[0060] The `GetProperties` method gets the property information of the base form, and the `GetMethods` method gets the method information of the base form. You can traverse the property and method list of the base form, get the name, type and other information of the base form property, and get the name, parameters and other information of the base form method.
[0061] 4. Based on the extracted type information, dynamically create a derived type, inherit the extracted basic form type information, thereby forming a form subtype, and the form subtype is instantiated to obtain the dynamically derived basic form. In the process of forming the dynamically derived basic form, the generated software platform import code and the primary form dynamic creation code generated according to the type information in the software platform import code are stored in the primary derived code file.
[0062] like Figure 3 As shown, Figure 3 The left side is the saved content of the first derived code file, where frmTSForm is the basic form type of the software platform, and new_ is the form subtype derived from the basic form type. Figure 3 The right side of the figure is the dynamically derived basic form obtained after the form subtype new_ is instantiated. It can be seen that since it inherits the basic form type frmTSForm, the new dynamically derived basic form also has several buttons 10 and a drop-down menu in the upper right corner of the toolbar included in the basic form type, and has the functions of corresponding button click events and drop-down menu operation events.
[0063] In some embodiments, user code refers to code written by a user. Since the first derived code file is derived based on the construction language of the software platform to form the existing content of the software platform, the first derived code file is not editable and does not include user code. When the properties and / or call events of the dynamically derived basic form are derived and modified, the user can modify the properties and / or call events of the dynamically derived basic form by writing code, so the N+1 derived code file can include user code.
[0064] In some embodiments, the user can also modify the properties and / or call events of the dynamically derived basic form by adding callable controls to the dynamically derived basic form; the callable control setting is a control list formed by the software platform system summarizing the user's usage habits, such as Figure 4 As shown in the right area, the controls in the control list are called callable controls. The user can embed these callable controls into the dynamically derived basic form from the control list, for example but not limited to, by dragging and dropping.
[0065] In some embodiments, after the derivation behavior is completed, the corresponding derived code file is run to form a derived user interface for interface interaction with the user.
[0066] In some embodiments, the software platform import code may be in Python code language, including: from software platform name import * or import software platform name.
[0067] In some embodiments, the software platform import code may also be in C or C++ code language, including: #include "software platform name".
[0068] Taking a case as an example, the specific process of inheriting the type information to form a dynamically derived basic form and deriving and modifying the properties and / or call events of the dynamically derived basic form is described in detail as follows:
[0069] Assuming that the form type in the type information of the basic form is TForm, the software platform user uses the form design tool provided by the software platform to inherit the form type TForm to form a form subtype TBaseForm, which is instantiated to form the dynamically derived basic form.
[0070] If a help button that is displayed on top is added to the dynamically derived basic form, that is, a button control is embedded in the dynamically derived basic form, then the software platform user clicks the code generation button on the form design tool to obtain the form dynamic creation code and the corresponding control creation code of the dynamically derived basic form:
[0071]
[0072]
[0073] Among them, "def__init__(self):" is the form creation event function definition, and its properties are modified by automatically calling the event. In the above case, the button creation function "Button(self)" is used to assign a value to the dynamically derived basic form property "btnHelp"; then the button control property "Parent" is set to the dynamically derived basic form, so that the button control can be displayed on the dynamically derived basic form; then the button control property "Align" is set to "alTop" so that the button control can be aligned at the top of the dynamically derived basic form; then the button control property "Caption" is set to "Help" so that the title of the button control is displayed as "Help", which is the help information.
[0074] As an optional implementation manner of some embodiments, the attributes include: visual elements of forms and controls and sub-members of forms and controls; the sub-members are functional variables and / or behavioral characteristic variables of forms and controls; the calling events include: one or more events of user interaction events, form and control life cycle events, and form and control function events.
[0075] In some embodiments, the properties also include: visual elements and sub-members of the control; the sub-members are functional variables and / or behavioral characteristic variables of the control; the calling events include: one or more events of user interaction events, control life cycle events, and control function events.
[0076] In some embodiments, the visual elements of the window include, but are not limited to, the color of the window body, the width of the window body, the height of the window body, the text information displayed in the window body, the coordinates of the window body in the main screen, transparency, icons, cursor type, etc.; the visual elements of the control include, but are not limited to, the color of the control, the width of the control, the height of the control, the text information displayed in the control, the coordinates of the control in the parent control, transparency, icons, cursor type, etc.
[0077] like Figure 5 As shown, the property items on the right show some properties of the form.
[0078] like Figure 6 As shown, the property items on the right show some properties of the control.
[0079] In some embodiments, the functional variables of forms and controls include, but are not limited to: font, drag and drop type, double buffer flag, right-click menu, help file, label value, etc.; the behavioral characteristic variables of forms and controls include, but are not limited to: activation status, visibility, alignment, automatic size adaptation, etc.
[0080] In some embodiments, user interaction events include, but are not limited to, click events, cursor key press events, cursor key pop-up events, cursor enter events, cursor move events, cursor leave events, keyboard press events, keyboard pop-up events, etc.; form and control life cycle events include, but are not limited to, create events, destroy events, etc.; form and control function events include, but are not limited to, timing events, display events, hide events, size change events, drawing events, etc.
[0081] In some embodiments, the method for deriving and modifying the properties and / or calling events of a dynamically derived basic form includes: writing the properties of the form by assignment and / or associating the event processing function with the calling event of the form by assignment, and forming a calling relationship with the user code.
[0082] In some embodiments, the method for deriving and modifying the properties and / or calling events of a dynamically derived basic form includes: writing the properties of the control by assignment and / or associating the event processing function with the calling event of the control by assignment, and forming a calling relationship with the user code.
[0083] Taking a case as an example, the specific process of writing the form's properties by assignment and forming a calling relationship with the user code is as follows:
[0084] Assuming that the form type in the type information of the basic form is TForm, the software platform user uses the form design tool provided by the software platform to inherit the form type TForm to form a form subtype TBaseForm, which is instantiated to form the dynamically derived basic form. The software platform user modifies the Tag property of the dynamically derived basic form to 1 in the form design tool, and then clicks the code generation button to obtain the form dynamic creation code of the dynamically derived basic form:
[0085] class TBaseForm(TForm):
[0086] def __init__(self):
[0087] self.Tag=1
[0088] Wherein "self.Tag=1" indicates writing into the Tag property of the dynamically derived basic form by assignment.
[0089] In this case, the properties of the dynamically derived basic form and / or the call events can also be modified by the user code added by the user. For example, in the user code, the user can determine the corresponding action according to the Tag property of the dynamically derived basic form. For example, when the Tag is 1, the title bar text of the dynamically derived basic form is set to "Run Mode = 1". The user code is as follows:
[0090] if 1 == self.Tag:
[0091] self.Caption="Run Mode="1"
[0092] Among them, "if 1 == self.Tag:" indicates that the user code forms a calling relationship with the attribute "Tag" of the dynamically derived basic form to call the attribute "Tag" of the dynamically derived basic form, and then determine the next action of the dynamically derived basic form.
[0093] Continuing with the above case, the specific process of associating the event handling function with the form's call event by assignment and forming a call relationship with the user code is described in detail as follows:
[0094] In the user code, the user can associate the display event of the dynamically derived base form to update the title bar text of the dynamically derived base form in the display event. The user code is as follows:
[0095] def on_show(Sender):
[0096] self.Caption="Form displayed"
[0097] self.OnShow = on_show
[0098] Among them, "def on_show(Sender):" is a user-defined event processing function, in which the user resets the title bar text of the dynamically derived basic form.
[0099] "on_show" means that the user associates the custom event handling function with the display event of the dynamically derived basic form by assignment.
[0100] Taking a case as an example, the specific process of writing the properties of the control by assignment and forming a calling relationship with the user code is as follows:
[0101] Assuming that the form type in the type information of the basic form is TForm, the software platform user uses the form design tool provided by the software platform to inherit the form type TForm to form a form subtype TBaseForm, which forms the dynamically derived basic form after instantiation. The software platform user adds a button btnTest to the dynamically derived basic form in the form design tool, changes the tag of the button btnTest to 1, and then clicks the code generation button on the form design tool to obtain the form dynamic creation code of the dynamically derived basic form and the control creation code of the button btnTest:
[0102]
[0103] Wherein "self.btnTest = Button (self)" is the code for creating the control of the button btnTest;
[0104] "self.btnTest.Tag=1" means writing the Tag attribute of the button through assignment.
[0105] In this case, the properties of the control and / or the call events can also be modified by the user code added by the user. For example, in the user code, the user can determine the corresponding action according to the Tag property of the button btnTest. For example, when the Tag is 1, the text of the button btnTest is set to "Run Mode = 1". The user code is as follows:
[0106] if 1 == self.btnTest.Tag:
[0107] self.btnTest.Caption="Run Mode="1"
[0108] Among them, "if 1 == self.btnTest.Tag:" indicates that the user code forms a calling relationship with the attribute "Tag" of the button btnTest, so as to call the attribute "Tag" of the button btnTest and then determine the next action of the button btnTest.
[0109] As an optional implementation of some embodiments, writing the properties of the form by assignment and forming a calling relationship with the user code includes:
[0110] Call the form's own function library, build corresponding parameters and pass them into the API function.
[0111] Taking a case as an example, the specific process of calling the form's own function library and building the corresponding parameters to pass into the API function is described in detail as follows:
[0112] In the form design tool, the user sets the width, height, left margin and top margin of the dynamically derived basic form. For example, width = 200, height = 100, left margin = 50, top margin = 30. The corresponding code snippet for dynamically creating the generated form is as follows:
[0113] self.SetBounds(50,30,200,100)
[0114] "SetBounds" is one of the functions of the dynamically derived basic form. Its function is to set the position and size of the dynamically derived basic form in the main screen. It carries four parameters. Assume that the corresponding list of parameter names and parameter values is as follows:
[0115] Parameter Name Parameter Value Left 50 Top 30 Width 200 Height 100
[0116] When the "SetBounds" function is called, the position of the dynamically derived base form is set to 50 pixels from the left side of the main screen and 30 pixels from the top of the main screen. At the same time, its width is set to 200 pixels and its height is set to 100 pixels.
[0117] As an optional implementation of some embodiments, the properties of the control are written by assignment, and a calling relationship is formed with the user code, including:
[0118] Call the control's own function library, build corresponding parameters and pass them into the API function.
[0119] Taking a case as an example, the specific process of calling the control's own function library and building corresponding parameters to pass into the API function is described in detail as follows:
[0120] In the form design tool, the user adds three items to the list box control (TControl), namely "Item 1", "Item 2" and "Item 3". The corresponding control creation code snippet is as follows:
[0121] self.ListBox1.Items.Assign(['Item 1','Item 2','Item 3'])
[0122] "Items.Assign" is one of the functions of the list box control. Its function is to set the content of the list box. It carries a parameter, which is a string array. When this function is called, the content of the list box control is updated to three lines of text, namely Item 1, Item 2 and Item 3.
[0123] As an optional implementation of some embodiments, writing the properties of the form by assignment and forming a calling relationship with the user code includes:
[0124] Call the user's function library and pass the form's properties as parameters to the API function.
[0125] Taking a case as an example, the specific process of calling the user's function library and passing the properties of the dynamically derived basic form as parameters to the API function is described in detail as follows:
[0126] There is an API function in the user's function library "userlib" that sets the form to the foreground. Its python prototype is defined as follows:
[0127] def set_top_most(AHandle:int)->None:"set window to top most"
[0128] This function has one parameter, which is the window handle. To use this user function library, you first need to import the function library in the user code. The code is as follows:
[0129] import userlib
[0130] Secondly, the user adds the calling code of the user function in the user code as follows:
[0131] userlib.set_top_most(self.Handle)
[0132] When the user function is called, the handle of the dynamically derived basic form is passed to the user function, that is, the dynamically derived basic form will be placed in the foreground.
[0133] As an optional implementation of some embodiments, the properties of the control are written by assignment, and a calling relationship is formed with the user code, including:
[0134] Call the user's function library and pass the control's properties as parameters to the API function.
[0135] Taking a case as an example, the specific process of calling the user's function library and passing the properties of the control as parameters to the API function is described in detail as follows:
[0136] There is an API function in the user's function library "userlib" for setting the text box style. Its python prototype is defined as follows:
[0137] def set_edit_style(AEdit:TEdit)->None:"set text edit style"
[0138] This function has one parameter, which is a text box object. To use this user function library, you first need to import the function library in the user code. The code is as follows:
[0139] import userlib
[0140] Secondly, the user adds the calling code of the user function in the user code as follows:
[0141] userlib.set_edit_style(self.edtTitle)
[0142] When the user function is called, the text box object edtTitle is passed into the user function, and the font style of the text box will be changed by the function.
[0143] As an optional implementation of some embodiments, writing the properties of the form by assignment and forming a calling relationship with the user code includes:
[0144] Call the function library of the software system and pass the properties of the form as parameters to the API function.
[0145] Taking a case as an example, the specific process of calling the function library of the software system and passing the properties of the dynamically derived basic form as parameters to the API function is described in detail as follows:
[0146] Assume that in this case, the dynamically derived basic form is a graphic display form provided by the software platform, and the graphic display form refers to a form provided by the software platform for displaying graphic curves.
[0147] There is a form screenshot function in the software system's function library "app", and its python prototype is defined as follows:
[0148] def take_screenshot(ACaption:str,AFileName:str)->None:"takescreenshot of specific form and save it to disk"
[0149] This function has two parameters. The first parameter is the window title name in text form, which is used to find the corresponding design window in the software platform; the second parameter is the target file name to save the screenshot image file to the hard disk. To use the function library of this software system, you first need to import the software platform name in the user code. The code is as follows:
[0150] Import software platform name
[0151] Secondly, the user adds the calling code of the software system function in the user code as follows:
[0152] app.take_screenshot("Graphics 1",r"C:\screenshots\graphics.png")
[0153] like Figure 7 and Figure 8 As shown in the figure, when the software system function is called, the title name of the graphics display window "Graphics 1" and the target file name "C:\screenshots\graphics.png" are passed into the software system function, and the screenshot information of the graphics display window will be saved to the hard disk. Figure 7 It can be seen that the derived graphic display window also has several buttons 10 and a drop-down menu at the upper right corner of the toolbar included in the basic window type, and has the functions of corresponding button click events and drop-down menu operation events.
[0154] As an optional implementation of some embodiments, the properties of the control are written by assignment, and a calling relationship is formed with the user code, including:
[0155] Call the function library of the software system and pass the properties of the control as parameters to the API function.
[0156] Taking a case as an example, the specific process of calling the function library of the software system and passing the properties of the control as parameters to the API function is described in detail as follows:
[0157] The software system's function library "app" contains a function for setting system variables in the software platform. Its python prototype is defined as follows:
[0158] def set_system_var_generic(AName:str,AValue:str)->None:"set systemvariable value from string"
[0159] This function has two parameters. The first parameter is the system variable name, which is used to find the corresponding system variable in the software platform. The second parameter is the target setting value in string form, which is used to set the value of the corresponding system variable to the target setting value. To use this software system function library, you first need to import the software platform name in the user code. The code is as follows:
[0160] Import software platform name
[0161] Secondly, the user adds the calling code of the software system function in the user code as follows:
[0162] app.set_system_var_generic('sysvar1',self.Button1.Caption)
[0163] The first parameter "sysvar1" passed in specifies the name of the corresponding system variable as "sysvar1".
[0164] The second parameter passed in uses the string value of the "Caption" property of the control "Button1" as the target setting value of the corresponding system variable.
[0165] If the string value of the "Caption" property of the control "Button1" is "3.5", then after calling the software system function, the value of the system variable "sysvar1" will be rewritten to "3.5".
[0166] As an optional implementation of some embodiments, writing the properties of the form by assignment and forming a calling relationship with the user code includes:
[0167] Call the function library of the code language and pass the form's properties as parameters to the API function.
[0168] Taking a case as an example, the specific process of calling the function library of the code language and passing the properties of the form as parameters to the API function is as follows:
[0169] Taking Python as an example, the calling code of the code language function added by the user in the user code is as follows:
[0170] self.Memo1.Text=dir(self.Icon)
[0171] "dir" is a function provided by the code language, which is used to obtain all the contents of a class or a module, including variables, methods, functions, and classes.
[0172] When the code language function is called, all the contents in the icon properties of the dynamically derived basic form are read into the multi-line text box "Memo1" by passing in the parameter "self.Icon".
[0173] As an optional implementation of some embodiments, the properties of the control are written by assignment, and a calling relationship is formed with the user code, including:
[0174] Call the function library of the code language and pass the properties of the control as parameters to the API function.
[0175] Taking a case as an example, the specific process of calling the function library of the code language and passing the properties of the control as parameters to the API function is described in detail as follows:
[0176] Taking Python as an example, the calling code of the code language function added by the user in the user code is as follows:
[0177] print(self.Button1.Caption)
[0178] Here, “print” is a function provided by the code language, which is used to print the string of corresponding parameters in the software system.
[0179] When the code language function is called, the "Caption" property of the control "Button1", that is, the label content of the control "Button1", is printed into the software system by passing in the parameter "Button1.Caption".
[0180] In summary, by modifying the properties and / or call events of the dynamically derived basic form and the controls embedded in the dynamically derived basic form, the modified derivation of the dynamically derived basic form can be realized. The user can also modify and derive the dynamically derived basic form multiple times according to the usage requirements, and each modification and derivation is performed on the basis of the previous modification and derivation. For example, the vehicle manufacturer can continue to add important vehicle-related signals to the graphic display form after the dynamic derived basic form is modified and derived once, and display them at a fixed position in the graphic display form, such as displaying the vehicle speed, wheel speed, etc., to form a secondary modified and derived graphic display form, and different parts manufacturers can continue to add special signals belonging to their respective parts manufacturers in their corresponding forms according to the secondary modified and derived graphic display form issued by the vehicle manufacturer, and display them in the secondary modified and derived graphic display form, such as displaying the braking deceleration, yaw angular velocity, etc., thereby forming three or more modified and derived graphic display forms.
[0181] like Figure 9 As shown, some embodiments further provide a user interface dynamic extensible development system based on a software platform, including:
[0182] The basic dynamic derivation module is configured to dynamically extract the form-related type information in the software platform runtime library through the interface manager during the software platform operation process, and inherit the type information to form a dynamically derived basic form, and the interface manager generates the software platform import code at the same time;
[0183] The derived code acquisition module is configured to generate a code for dynamically creating a form according to the type information in the software platform import code, and store the software platform import code and the code for dynamically creating a form into a derived code file.
[0184] Among them, the specific implementation functions of the basic dynamic derivation module and the derived code acquisition module are implemented in a processor or in a computer device. For details, please refer to the content of the aforementioned dynamic and extensible development method of user interface based on software platform, which will not be repeated here.
[0185] The electronic devices involved in some embodiments are described below from the perspective of hardware processing, but the specific implementation of the electronic devices is not limited.
[0186] like Figure 10 As shown, the electronic device includes: a processor, a readable storage medium, a communication bus and a communication interface; wherein the processor, the readable storage medium and the communication interface communicate with each other through the communication bus; the readable storage medium is used to store a program for executing the dynamic and extensible user interface development method based on a software platform, and the processor is configured to execute the program for executing the dynamic and extensible user interface development method based on a software platform.
[0187] In other embodiments, a computer device or an industrial computer may also be used as a type of electronic device.
[0188] Figure 10 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0189] In some embodiments, the communication interface may be RS232, RS485, USB port, TYPE port, etc., which may be connected to an external bus adapter. It may also include a wired or wireless network interface, and the network interface may optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to establish a communication connection between the computer device and other electronic devices.
[0190] Among them, the readable storage medium or computer-readable storage medium includes at least one type of memory, and the memory includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, it can be an internal storage unit of a computer device, such as a hard disk of the computer device. In other embodiments, the memory can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory can also include both an internal storage unit of a computer device and an external storage device. The memory can not only be used to store application software and various types of data installed in the computer device, such as the code of a computer program, etc., but can also be used to temporarily store data that has been output or is to be output.
[0191] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip for running program codes stored in a memory or processing data, such as executing a computer program.
[0192] In some embodiments, the communication bus may also be an input / output bus, which may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0193] In some embodiments, a computer device includes: a processor; and a readable storage medium and a display module electrically connected to the processor; wherein the readable storage medium is used to store a program for executing the software platform-based dynamic and extensible user interface development method; the processor is configured to execute the program to generate a corresponding user interface; and the display module is configured to display the user interface.
[0194] Optionally, the computer device may further include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and optionally, the user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the computer device and to display a visual user interface.
[0195] When the processor executes the program, the above Figure 1 The steps in the embodiment of the software platform-based user interface development method can be dynamically extensible, for example Figure 1 Alternatively, when the processor executes the computer program, the functions of each module or unit in the above-mentioned device embodiments are realized.
[0196] This embodiment also provides a computer-readable storage medium, on which is stored a program of a method for dynamically extensible development of a user interface based on a software platform. When the program is executed by a processor, the specific steps of the method for dynamically extensible development of a user interface based on a software platform can be implemented. Please refer to the specific description of the method for dynamically extensible development of a user interface based on a software platform, which will not be repeated here.
[0197] Some embodiments further provide a computer program product, including a computer program or instructions, wherein when the computer program or instructions are executed on a computer, the computer is enabled to execute any possible software platform-based dynamic and extensible user interface development method described above.
[0198] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0199] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0200] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0201] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.
Claims
1. A method for dynamically extensible development of a user interface based on a software platform, characterized in that: include: During the operation of the software platform, the interface manager dynamically extracts the type information related to the form in the software platform runtime library, inherits the type information to form a dynamically derived basic form, and generates the software platform import code by the interface manager; as well as Generate a code for dynamically creating a form according to the type information in the software platform import code, and store the software platform import code and the code for dynamically creating a form in a derived code file; During the operation of the software platform, the method for the interface manager to dynamically extract the form-related type information in the software platform runtime library includes: Importing the system runtime type information unit into the internal implementation code of the software platform to use the classes and methods related to the form in the unit; Use the Runtime Type Information Context Type class in the system runtime type information unit to create a context object, and then use the Get Runtime Type Information Type method to get the Runtime Type Information object of the form; and Use the "Get Properties" method to get the form's property information and the "Get Methods" method to get the form's method information through the form's "Runtime Type Information" object.
2. The method for dynamically scalable development of a user interface based on a software platform according to claim 1, characterized in that: If the attributes and / or call events of the dynamically derived basic form are modified N+1 times by derivation, an N+1-time derived code file is created, wherein the N+1-time derived code file includes: N-time derived code file import code, N+1-time form dynamic creation code and / or user code, wherein N≥1; and The N+1 derived code files are run to form an N+1 derived user interface.
3. The method for dynamically scalable development of a user interface based on a software platform according to claim 2, characterized in that: The interface manager is used to create, list, design, save, import, export, encrypt and run user interfaces.
4. The method for dynamically scalable development of a user interface based on a software platform according to claim 2, characterized in that: The properties include: visual elements and child members of the form; The sub-members are function variables and / or behavior characteristic variables of the form; The calling event includes: one or more events of a user interaction event, a form life cycle event, and a form function event.
5. The method for dynamically scalable development of a user interface based on a software platform according to claim 4, characterized in that: Methods for modifying the properties and / or calling events of a dynamically derived base form include: Write the form's properties by assigning values and forming a calling relationship with the user code; or The event handling function is associated with the call event of the form by assigning a value.
6. The method for dynamically scalable development of a user interface based on a software platform according to claim 5, characterized in that: Write the form's properties by assigning values, and form a calling relationship with the user code, including: Call the form's own function library, build corresponding parameters and pass them into the API function.
7. The method for dynamically scalable development of a user interface based on a software platform according to claim 5, characterized in that: Write the form's properties by assigning values, and form a calling relationship with the user code, including: Call the user's function library and pass the form's properties as parameters to the API function.
8. The method for dynamically scalable development of a user interface based on a software platform according to claim 5, characterized in that: Write the form's properties by assigning values, and form a calling relationship with the user code, including: Call the function library of the software system and pass the properties of the form as parameters to the API function.
9. The method for dynamically scalable development of a user interface based on a software platform according to claim 5, characterized in that: Write the form's properties by assigning values, and form a calling relationship with the user code, including: Call the function library of the code language and pass the form's properties as parameters to the API function.
10. A user interface dynamic and extensible development system based on a software platform, characterized in that: include: The basic dynamic derivation module is configured to dynamically extract the form-related type information in the software platform runtime library through the interface manager during the software platform operation process, and inherit the type information to form a dynamically derived basic form, and the interface manager generates the software platform import code at the same time; The derived code acquisition module is configured to generate a code for dynamically creating a form according to the type information in the software platform import code, and store the software platform import code and the code for dynamically creating a form in a derived code file; During the operation of the software platform, the method for the interface manager to dynamically extract the form-related type information in the software platform runtime library includes: Importing the system runtime type information unit into the internal implementation code of the software platform to use the classes and methods related to the form in the unit; Use the Runtime Type Information Context Type class in the system runtime type information unit to create a context object, and then use the Get Runtime Type Information Type method to get the Runtime Type Information object of the form; and Use the "Get Properties" method to get the form's property information and the "Get Methods" method to get the form's method information through the form's "Runtime Type Information" object.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium is configured to store a program for executing the method for dynamically extensible development of a user interface based on a software platform as claimed in claim 1 .
12. A processor, characterized in that: The processor is configured to execute the program of the method for dynamically extensible development of a user interface based on a software platform as claimed in claim 1.
13. An electronic device, comprising: Processor, readable storage medium, communication bus and communication interface; wherein the processor, the readable storage medium and the communication interface communicate with each other via the communication bus; The readable storage medium is used to store a program for executing the method for dynamically extensible development of a user interface based on a software platform as described in claim 1, and the processor is configured to execute the program for dynamically extensible development of a user interface based on a software platform as described in claim 1.
14. A computer device, characterized in that: include: processor; as well as a readable storage medium and a display module electrically connected to the processor; in The readable storage medium is used to store a program for executing the method for dynamically extensible development of a user interface based on a software platform as claimed in claim 1; The processor is configured to execute the program to generate a corresponding user interface; The display module is configured to display the user interface.