[go: up one dir, main page]

CN118819517A - A control display method, system, device and storage medium - Google Patents

A control display method, system, device and storage medium Download PDF

Info

Publication number
CN118819517A
CN118819517A CN202410792622.6A CN202410792622A CN118819517A CN 118819517 A CN118819517 A CN 118819517A CN 202410792622 A CN202410792622 A CN 202410792622A CN 118819517 A CN118819517 A CN 118819517A
Authority
CN
China
Prior art keywords
control
configuration table
display
interface element
triggering operation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410792622.6A
Other languages
Chinese (zh)
Inventor
谭利华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Lan You Technology Co Ltd
Original Assignee
Shenzhen Lan You Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Lan You Technology Co Ltd filed Critical Shenzhen Lan You Technology Co Ltd
Priority to CN202410792622.6A priority Critical patent/CN118819517A/en
Publication of CN118819517A publication Critical patent/CN118819517A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

本发明公开了一种控件的显示方法、系统、装置及存储介质。该方法包括:建立配置表;所述配置表用于表征用户界面元素的组合、属性、样式;根据配置表,在用户界面文件中构建控件;所述控件的参数由所述配置表确定,所述参数包括显示名称、类型、默认值;响应于对显示事件的触发操作,在目标区域中加载并显示所述控件。本申请实施例通过建立配置表,自动在用户界面文件中创建界面元素,无需对单个界面元素进行设计和修改,提升控件显示的效率,加快开发周期。本方法可以广泛应用于计算机技术领域。

The present invention discloses a method, system, device and storage medium for displaying a control. The method comprises: establishing a configuration table; the configuration table is used to characterize the combination, attributes and style of user interface elements; constructing a control in a user interface file according to the configuration table; the parameters of the control are determined by the configuration table, and the parameters include display name, type and default value; in response to a triggering operation on a display event, the control is loaded and displayed in a target area. The embodiment of the present application automatically creates interface elements in a user interface file by establishing a configuration table, without the need to design and modify individual interface elements, thereby improving the efficiency of control display and accelerating the development cycle. The method can be widely used in the field of computer technology.

Description

Control display method, system, device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a control display method, system, device, and storage medium.
Background
In developing applications using PyQt5, it is often necessary to add various elements in the interface, such as buttons, input boxes, labels, drop-down boxes, and the like. In the related art, by starting QT DESIGNER an interface design tool in PyCharm, a UI file is created, elements are dragged one by one to a design area according to the requirement, and attributes, styles, and the like of the elements are set. The UI file is then converted to a Python code file by command, and the graphical user interface is then presented by invoking the Python code. When a large number of graphical user interfaces need to be drawn in one project, a large number of UI files need to be created, dragging is carried out element by element, and the development period is long. If the style needs to be changed comprehensively (such as fonts, font sizes, height and width, etc.), each UI file needs to be adjusted, the development efficiency will be very low, and the style will be easily non-uniform.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art to a certain extent.
Therefore, the invention aims to provide an efficient control display method, system and device and a storage medium.
In order to achieve the technical purpose, the technical scheme adopted by the embodiment of the invention comprises the following steps:
In one aspect, an embodiment of the present application provides a method for displaying a control, including the following steps: establishing a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements; constructing a control in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values; and loading and displaying the control in the target area in response to the triggering operation of the display event. According to the embodiment of the application, the configuration table is built, the interface elements are automatically created in the user interface file, the design and modification of single interface elements are not needed, the control display efficiency is improved, and the development period is accelerated.
In addition, the display method of the control according to the above embodiment of the present invention may further have the following additional technical features:
Further, in the method for displaying a control according to the embodiment of the present invention, the constructing the control in the user interface file according to the configuration table includes:
reading control configuration data from the configuration table through a target library of a target programming language, and generating a target object according to the control configuration data;
preprocessing the target objects, and determining a graphical interface and a control ordering in each graphical interface;
According to the interface element types in the configuration table, matching standard controls for the interface elements in each graphical interface;
And setting attributes for the standard controls according to the attributes and the styles in the configuration table, and constructing the controls by combining the control ordering.
Further, in an embodiment of the present invention, the establishing a configuration table includes:
determining a group code of the configuration table; the group is encoded into a group of graphical interfaces comprising a plurality of interface elements; the set of codes is used for retrieving to obtain all configuration items of a set of graphical interfaces; the group code is also used for calling back the function name of the function so as to execute the self-defining function;
determining a sub-category; the sub-category is used to sub-group interface elements.
Further, in one embodiment of the present invention, the method further comprises the steps of:
determining interface element codes, interface element types and interface element display names; the interface element codes are unique codes of the current interface element in the current graphical interface, and the interface element codes are used for calling back parameters of the function; the interface element type comprises a text box, a drop-down box and a check box; the interface element displays a label text;
if the current interface element type is a drop-down frame, determining a value list; the elements in the value list are option lists of the drop-down frame;
determining default values and parameter types; the parameter type is used for representing whether the interface element needs to be transmitted into the callback function.
Further, in one embodiment of the present invention, the loading and displaying the control in the target area in response to the triggering operation of the display event includes:
and responding to the triggering operation of the display event, displaying the text corresponding to the sub-category, and configuring a folding button to fold or unfold the controls in the group.
Further, in one embodiment of the present invention, the loading and displaying the control in the target area in response to the triggering operation of the display event includes:
responding to the triggering operation of the display event, displaying a control according to the type of the interface element, and displaying the display name of the interface element at the target position of the current control;
If the current interface element type is a drop-down frame, responding to a trigger operation of a display event, and displaying the default value in a drop-down option of the drop-down frame; or if the current interface element type is an input box, responding to the triggering operation of the display event, and displaying the default value at the text of the input box; or if the current interface element type is a check box, responding to the triggering operation of the display event, and filling the check options of the check box according to the default value;
If the current parameter type is non-parameter, responding to the triggering operation of the display event, and displaying a corresponding text in a text box of the current control; or if the current parameter type is an input parameter, responding to the triggering operation of the display event, determining the input parameter of the callback function according to the interface element code and the default value, and displaying the default value in the current control; or if the current parameter type is the output parameter, responding to the triggering operation of the display event, receiving the return value of the callback function, and displaying in the current control.
Further, in one embodiment of the present invention, the loading and displaying the control in the target area in response to the triggering operation of the display event includes:
responding to the triggering operation of the display event, and loading the controls from top to bottom in the target area according to the order from top to bottom or from bottom to top by sequencing the controls;
or in response to a triggering operation on a display event, the controls are loaded from left to right in the target area in order of from big to small or from small to big.
In another aspect, an embodiment of the present invention provides a display system for a control, including:
The first module is used for establishing a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements;
The second module is used for constructing a control in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values;
and the third module is used for responding to the triggering operation of the display event and loading and displaying the control in the target area.
In another aspect, an embodiment of the present invention provides a display device for a control, including:
At least one processor;
at least one memory for storing at least one program;
And when the at least one program is executed by the at least one processor, the at least one processor is caused to implement the control display method.
In another aspect, an embodiment of the present invention provides a storage medium in which a program executable by a processor is stored, where the program executable by the processor is configured to implement the method for displaying a control described above when executed by the processor.
The method provided by the embodiment of the application comprises the following steps: establishing a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements; constructing a control in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values; and loading and displaying the control in the target area in response to the triggering operation of the display event. According to the embodiment of the application, the configuration table is built, the interface elements are automatically created in the user interface file, the design and modification of single interface elements are not needed, the control display efficiency is improved, and the development period is accelerated.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description is made with reference to the accompanying drawings of the embodiments of the present invention or the related technical solutions in the prior art, and it should be understood that the drawings in the following description are only for convenience and clarity of describing some embodiments in the technical solutions of the present invention, and other drawings may be obtained according to these drawings without the need of inventive labor for those skilled in the art.
FIG. 1 is a flow chart of an embodiment of a control display method provided by the present invention;
fig. 2 is a flowchart illustrating another embodiment of a control display method provided by the present invention;
FIG. 3 is an interface display schematic diagram of an embodiment of a control corresponding to a sub-category provided in the present invention;
FIG. 4 is an interface presentation schematic diagram of an embodiment of a control corresponding to a callback function provided by the present invention;
FIG. 5 is an interface display schematic diagram of an embodiment of a control corresponding to a value list provided by the present invention;
FIG. 6 is a schematic diagram illustrating an interface display of one embodiment of a control dynamic display area provided by the present invention;
FIG. 7 is a schematic diagram illustrating an interface display of one embodiment of a control display process provided by the present invention;
FIG. 8 is a schematic diagram of an embodiment of a display system for a control provided by the present invention;
fig. 9 is a schematic structural diagram of an embodiment of a display device of a control provided by the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention. The step numbers in the following embodiments are set for convenience of illustration only, and the order between the steps is not limited in any way, and the execution order of the steps in the embodiments may be adaptively adjusted according to the understanding of those skilled in the art.
Term interpretation:
Python: a high-level, generic, interpreted programming language.
UI: the user interface is equivalent to a GUI (graphical user interface) in the present application.
PyQt5: a Python module for creating desktop applications provides rich GUI (graphical interface) components and functionality.
Control: graphical interface component elements such as buttons, labels, text boxes, drop-down boxes, check boxes, and the like.
Interface element: equivalent to a control, for example, an input box, a drop down box, a check box, and tab text are all one interface element (control).
PyCharm: an Integrated Development Environment (IDE) is specially used for Python development.
QT DESIGNER: a visual interface design tool enables a developer to quickly design and layout interface elements such as buttons, labels, text boxes, etc. by dragging and dropping and setting properties. The tool is installed in PyCharm as a plug-in and can be directly actuated therefrom.
Pandas: an open source data analysis library in Python provides an efficient data structure and a data analysis tool, and can read, analyze and visualize Excel data.
In developing applications using PyQt5, it is often necessary to add various elements in the interface, such as buttons, input boxes, labels, drop-down boxes, and the like. The conventional method is to start QT DESIGNER an interface design tool in PyCharm, create a UI file, drag the elements one by one to the design area according to the requirement, and set the properties, styles, etc. of the elements. The UI file is then converted to a Python code file by pyuic commands, and the graphical user interface is then presented by invoking the Python code. When a large number of graphical user interfaces need to be drawn in one project, a large number of UI files need to be created, dragging is carried out element by element, and the development period is long. If the style needs to be changed comprehensively (such as fonts, font sizes, height and width, etc.), each UI file needs to be adjusted, the development efficiency will be very low, and the style will be easily non-uniform.
In summary, the technical drawbacks of the prior art solutions are as follows:
The developer manually creates a UI file, dragging elements (buttons, input boxes, drop-down boxes, etc.) to the interface design area. Then the attributes, styles, etc. of the elements are set, and then a Python method for displaying the graphical interface is generated through pyuic commands.
The UI file is fixed, if the interface elements need to be added or reduced, the UI file needs to be manually changed, and then the Python method is generated through commands again, so that the work is complex.
When a large number of user interfaces of the same type need to be created, even if one template UI file is copied, the interface elements on each UI file need to be manually adjusted, and Python code generation is performed.
According to the technical scheme provided by the application, interface elements are dynamically generated in a fixed UI file according to the configuration table (which can be in an Excel file form), and the display names, types and default values of the interface elements can be specified in the configuration table, so that the development efficiency of UI developers is greatly improved. The scheme is not only suitable for developers of professional software companies, but also suitable for common users.
According to the UI element sequence, attribute, style and the like in the configuration table (Excel file), the interface elements are automatically created in the fixed UI file, and a method for displaying the interface is not required to be generated through pyuic commands, and a unified entry method is provided for displaying the image interface. When an element of a certain graphical interface (such as adding or subtracting an element, adjusting an element position, setting an element default value, etc.) needs to be updated, only the updating is needed in the Excel configuration table, the UI file does not need to be updated, and the Python code regeneration does not need to be performed. An Excel table is provided with a unique code to represent a graphical interface (which may contain multiple interface elements), and multiple graphical interfaces may be created by adding the unique code, or even infinitely extended. Even an average person without programming basis can participate in the task of configuring the graphical user interface in the project.
The method and system for displaying a control according to the embodiments of the present invention are described in detail below with reference to the accompanying drawings, and first, the method for displaying a control according to the embodiments of the present invention will be described with reference to the accompanying drawings.
Referring to fig. 1, a control display method is provided in an embodiment of the present invention, where the control display method in the embodiment of the present invention may be applied to a terminal, or may be applied to a server, or may be software running in the terminal or the server, or the like. The terminal may be, but is not limited to, a tablet computer, a notebook computer, a desktop computer, etc. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms. The control display method in the embodiment of the invention mainly comprises the following steps:
S100: establishing a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements;
s200: constructing a control in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values;
s300: in response to a triggering operation for a display event, a control is loaded and displayed in the target area.
In some possible implementations, the configuration table in the embodiments of the present application may be an Excel table, or may be set as another form of database/data table according to the requirements, which is not particularly limited in the present application. The configuration table may be set according to requirements of interface elements, and contents in the configuration table may also be set according to requirements, including, but not limited to, combinations, attributes, and styles of interface elements. In the embodiment of the application, the interface element, namely the control, and a plurality of controls form a graphical interface. In the configuration table, a plurality of graphical interfaces can be set for one-time loading, so that the efficiency is improved. The corresponding relation between the configuration table and the display control can be set according to actual requirements, and the diversity of designs is improved.
Optionally, in one embodiment of the present invention, building a control in the user interface file according to the configuration table includes:
Reading control configuration data from the configuration table through a target library of a target programming language, and generating a target object according to the control configuration data;
preprocessing a target object, and determining a graphical interface and a control sequence in each graphical interface;
according to the interface element types in the configuration table, matching standard controls for the interface elements in each graphical interface;
and setting attributes for the standard controls according to the attributes and the styles in the configuration table, and constructing the controls by combining control ordering.
In some possible implementations, the display methods of embodiments of the present application may be used in a variety of programming languages or programming environments. Illustratively, for the Python language, the target programming language in the embodiment of the present application is Python language, and the target library is a third party library (Pandas). The target object is an object that can be processed by the target programming language, and for the Python language, the target object is DATAFRAME objects.
Optionally, in one embodiment of the present invention, establishing the configuration table includes:
Determining a group code of the configuration table; group encoding into a group of graphical interfaces comprising a plurality of interface elements; the group code is used for retrieving to obtain all configuration items of a group of graphical interfaces; the group code is also used for calling back the function name of the function so as to execute the self-defining function;
determining a sub-category; the subcategories are used to group interface elements a second time.
In some possible implementations, the graphical interface in embodiments of the present application includes a plurality of interface elements/controls, a group code being used to characterize the code of a group of graphical interfaces. The subcategories are used for secondary grouping, facilitating interface display.
Optionally, in one embodiment of the present invention, the method further comprises:
Determining interface element codes, interface element types and interface element display names; the interface element code is a unique code of the current interface element in the current graphical interface, and the interface element code is used for calling back parameters of the function; interface element types include text boxes, drop-down boxes, check boxes; the interface element displays a label text;
If the current interface element type is a drop-down frame, determining a value list; the elements in the value list are option lists of drop-down boxes;
determining default values and parameter types; the parameter type is used to characterize whether the interface element requires an incoming callback function.
Optionally, in one embodiment of the present invention, loading and displaying a control in a target area in response to a triggering operation for a display event includes:
And responding to the triggering operation of the display event, displaying texts corresponding to the sub-categories, and configuring a folding button to fold or unfold the controls in the group.
Optionally, in one embodiment of the present invention, loading and displaying a control in a target area in response to a triggering operation for a display event includes:
Responding to the triggering operation of the display event, displaying the control according to the type of the interface element, and displaying the display name of the interface element at the target position of the current control;
If the current interface element type is a drop-down frame, responding to the triggering operation of the display event, and displaying a default value in a drop-down option of the drop-down frame; or if the current interface element type is an input box, responding to the triggering operation of the display event, and displaying a default value at the text of the input box; or if the current interface element type is a check box, responding to the triggering operation of the display event, and filling the check box with a check option according to a default value;
if the current parameter type is non-parameter, responding to the triggering operation of the display event, and displaying a corresponding text in a text box of the current control; or if the current parameter type is an input parameter, responding to the triggering operation of the display event, determining the input parameter of the callback function according to the interface element code and the default value, and displaying the default value in the current control; or if the current parameter type is the output parameter, responding to the triggering operation of the display event, receiving the return value of the callback function, and displaying in the current control.
In some possible embodiments, the target location may be any location around the control that is closer to the control, and the use of the control is characterized by the interface element display name. Default values are displayed at the corresponding text for the different types of interface elements. According to the embodiment of the application, the relation among parameters such as group coding, interface element coding, parameter types and the like is represented by the callback function so as to realize the display of the control.
Optionally, in one embodiment of the present invention, loading and displaying a control in a target area in response to a triggering operation for a display event includes:
responding to the triggering operation of the display event, and loading the controls from top to bottom in the target area according to the order from top to bottom or from bottom to top;
or in response to a triggering operation on a display event, the controls are loaded in the target area from left to right in order of from big to small or from small to big.
In some possible implementations, control ordering is used to characterize the positional relationship of controls in the display area.
Optionally, in one embodiment of the present application, the method provided by the present application further includes:
Updating the configuration table;
and constructing a control in the user interface file according to the updated configuration table.
It can be understood that, in the embodiment of the present application, the update operation includes operations of adding an interface element, reducing an interface element, changing an interface element, and the like, when the update of the interface element is required, only the configuration table needs to be updated, the updated configuration table is loaded once when the software is opened, and a tree node is automatically generated after the loading (the loading is completed instantaneously). The embodiment of the application quickens the design and display flow of interface elements and improves the efficiency.
The scheme is designed for improving the working efficiency of interface development by using PyQt 5. The function realized by the scheme is to help a developer to dynamically construct the PyQt5 control after configuration according to rules, so that the development of the interface is completed rapidly. Referring to fig. 2, the scheme is divided into three parts, namely control combination configuration, control dynamic construction and control display.
Specifically, for the control combination configuration, the control combination configuration is completed through an Excel file, and as for one embodiment shown in table 1, the design of the configuration table is performed. Wherein the group code is used to determine a unique code for a group of interface elements, and subsequent click events will determine which interface elements to display by passing the code. The subcategories are multiple subcategories under a control group for further grouping interface elements. The interface element code is the smallest unit of interface element (e.g., text box, button) code, unique within a group. The interface element display name is the interface element display label name. The interface element type may be a text box, a drop down box, a check box. The value list is valid only when the box is pulled down, indicating all options of the pull down list. Default values are default values, such as default text in the input box, whether the check box is checked by default. The parameter type defines whether the interface element requires an incoming callback function. The rank numbers are rank numbers within a group, and may be ordered from small to large in number.
TABLE 1
Wherein, the table fields are fixed, the definition of each field is described in detail in table 1, when the controls are configured, the controls need to be grouped according to rules, and the attribute (such as the control type, the optional value, the default value, etc.) of each control is set.
The control logic for each field is described as follows:
Group coding: the group codes are obtained from the component tree (a tree structure list, each leaf node corresponding to a unique group code) by a single click event, and all configuration items are obtained by retrieving from the configuration table according to the group codes. The group code is also used as a function name of a callback function for executing a specific function (developing customized Python code).
Subcategories: the subcategory is used for grouping the controls of the group twice, the text of this field can be any value, the text is to be displayed in bold (corresponding to Label controls in PyQt 5) and is provided with a folding button, and the controls belonging to the subcategory are to be displayed in retract and can be folded and unfolded, as shown in figure 3.
Interface element encoding: each interface element needs to be provided with a code that is unique across the entire group, which is used as a parameter in the callback function. Each group code pairs a callback function for performing a specific function according to information entered on the interface element, which is defined by the developer itself. FIG. 4 illustrates the detailed translation of callback functions with group coding, interface element coding, parameter types.
Interface element display name: this display name is labeled text such as "display name", "URL", "browser type", etc. appearing in fig. 4, which is descriptive text for helping the user understand the present parameters, and each control automatically generates a label to be displayed on the left side.
Interface element type: the interface element types may be text boxes, drop-down boxes, check boxes, etc., how the field values match standard controls in the PyQt5 library in the control dynamic building section of the present application.
List of values: this field is only valid when the interface element type is a drop-down box, separating the values by comma (,) that will build the option list of the drop-down box, as shown in fig. 5.
Default value: refers to the default value displayed on the interface element. Selecting a drop-down option according to a default value if the interface element type is a drop-down box; if the text is the input box, displaying the text in the input box; if the check box is the check box, default checking is carried out according to the value True, and if the check box is False, the check box is not checked.
Parameter type: 0-non-parameter, pure display of class text; 1-an input parameter used for calling back the input parameter in brackets in the function; 2-outputting parameters and receiving the return value of the callback function.
Sequence number: the sorting number from small to large is used for controlling the display sequence of the interface elements and represents the display sequence of the control from top to bottom.
Two examples are given in Table 1, the first example representing a combination named mc. Print_my having two controls, both types being text boxes; the second example is more complex, has five properties, covers three types of text boxes, drop-down boxes, check boxes, and designates drop-down option values, i.e., default options, for drop-down boxes.
For dynamic control construction, the method is divided into four small steps.
Step S21, loading configuration. The control configuration data is read from Excel using a third party library (Pandas) in the Python language and converted to DATAFRAME objects that can be handled in the Python language.
Step S22, preprocessing:
Step S221, the first layer grouping is encoded according to groups, and each group is encoded into a control set;
Step S222, grouping the control sets according to sub-categories, and performing finer processing on the control;
Step S223, ascending according to the sequence number, wherein the smaller the sequence number is, the more the control is presented on the interface in the future, namely, the control is arranged from top to bottom;
Step S23, matching controls;
Step S231, matching standard controls in the PyQt5 according to interface element types in the configuration table;
s232, text-QLINEEDIT, representing a text input box, and setting ash;
step S233, a pull-down frame QComboBox, representing the pull-down frame;
Step S234, check box < - > QCheckBox, representing a check box, true or False;
step S235, button-QPushButton, represents clicking the button.
Step S24, setting attributes;
step S241, each control has respective attribute and style to be set;
step S242, constructing a drop-down option of a drop-down frame from a value list of a configuration table;
Step S243, the default value is assigned from the default value in the configuration table, and the default values of the drop-down boxes and the check boxes are supported;
Step S244, subcategory represents a two-level grouping, displayed by default with Qlabel (tab) and bolded, adding a fold button.
The following shows part of the code that builds the drop down box:
if the interface element type is a drop down box, if the if ui_type= = =' combox #
A_widget= QComboBox (self) # creates a drop-down box container
Defaultval=str (row [ 'defaultval' ]) # obtains a list of values in the configuration table (drop-down option)
If the list of values is not empty, # if the list of if not default_val_isspace ()
For it in default _val split (',') # circulates after splitting according to comma (,) s
A_widget.additem (it) # each split item automatically adds a drop-down list option
If str (row [ 'value' ]) ] is! = ": # if default is not null
The a_widget.setcurrenttext (str [ 'value' ]) # set drop-down box automatically selects the list item identical to the default value
Transfer values on interface elements into callback functions using PyQt5 self-contained partial functions
on_index_changed_with_args=partial(self.on_combo_index_changed,
le=a_widget,index=index)
# Passing new value to a_widget.currentIndexChanged.connect (on_index_changed_with_ args) in callback function automatically through the slot signal in PyQt5 when different drop-down option is selected
For control display, because the control is dynamically built, the control is loaded according to the requirement, and when a display event is triggered by clicking, the control is displayed in a specific area. This display area is a container-type control (tabWidget) in the PyQt5, within which any standard control of PyQt5 can be displayed, as shown in fig. 6.
Fig. 7 shows an example corresponding to example 2 in the above configuration table.
According to the embodiment of the application, the UI interface elements are arranged through the configuration table, so that a developer does not need to manually create a UI file, and does not need to convert the UI file into a Python code, and the development efficiency is greatly improved. Because only one UI file exists, the interface elements are dynamically created on the UI file when the program is run, so that the number of files in the Python project is greatly reduced, and the maintenance cost is reduced. When the UI interface needs to be adjusted, only the configuration table needs to be adjusted, and the UI interface is more flexible to use. If the styles (such as fonts, widths, etc.) of the interface elements need to be uniformly adjusted, only the codes for dynamically creating the interface elements need to be adjusted, and the adjustment of the UI file does not need to be performed.
In summary, the method provided by the embodiment of the application includes: establishing a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements; constructing a control in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values; in response to a triggering operation for a display event, a control is loaded and displayed in the target area. According to the embodiment of the application, the configuration table is built, the interface elements are automatically created in the user interface file, the design and modification of single interface elements are not needed, the control display efficiency is improved, and the development period is accelerated.
Next, a display system of a control according to an embodiment of the present invention will be described with reference to fig. 8. The system specifically comprises:
A first module 810 for creating a configuration table; the configuration table is used for representing the combination, attribute and style of the user interface elements;
A second module 820 for building controls in the user interface file according to the configuration table; parameters of the control are determined by the configuration table, and the parameters comprise display names, types and default values;
a third module 830 is configured to load and display a control in the target area in response to a triggering operation for the display event.
It can be seen that the content in the above method embodiment is applicable to the system embodiment, and the functions specifically implemented by the system embodiment are the same as those of the method embodiment, and the beneficial effects achieved by the method embodiment are the same as those achieved by the method embodiment.
Referring to fig. 9, an embodiment of the present invention provides a display device of a control, including:
at least one processor 910;
at least one memory 920 for storing at least one program;
The at least one program, when executed by the at least one processor 910, causes the at least one processor 910 to implement a method of displaying the control.
Similarly, the content in the above method embodiment is applicable to the embodiment of the present device, and the functions specifically implemented by the embodiment of the present device are the same as those of the embodiment of the above method, and the beneficial effects achieved by the embodiment of the above method are the same as those achieved by the embodiment of the above method.
The embodiment of the invention also provides a computer readable storage medium, in which a program executable by a processor is stored, which when executed by the processor is used for executing the display method of the control.
Similarly, the content in the above method embodiment is applicable to the present storage medium embodiment, and the specific functions of the present storage medium embodiment are the same as those of the above method embodiment, and the achieved beneficial effects are the same as those of the above method embodiment.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the invention is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the functions and/or features may be integrated in a single physical device and/or software module or may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Accordingly, one of ordinary skill in the art can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the invention, which is to be defined in the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in the form of a software product stored in a storage medium, including several programs for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable programs for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with a program execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the programs from the program execution system, apparatus, or device and execute the programs. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the program execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable program execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the foregoing description of the present specification, reference has been made to the terms "one embodiment/example", "another embodiment/example", "certain embodiments/examples", and the like, means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the embodiments described above, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present invention, and these equivalent modifications and substitutions are intended to be included in the scope of the present invention as defined in the appended claims.

Claims (10)

1.一种控件的显示方法,其特征在于,包括以下步骤:1. A method for displaying a control, characterized in that it comprises the following steps: 建立配置表;所述配置表用于表征用户界面元素的组合、属性、样式;Establishing a configuration table; the configuration table is used to represent the combination, attributes, and styles of user interface elements; 根据配置表,在用户界面文件中构建控件;所述控件的参数由所述配置表确定,所述参数包括显示名称、类型、默认值;According to the configuration table, construct a control in the user interface file; the parameters of the control are determined by the configuration table, and the parameters include display name, type, and default value; 响应于对显示事件的触发操作,在目标区域中加载并显示所述控件。In response to the triggering operation of the display event, the control is loaded and displayed in the target area. 2.根据权利要求1所述的控件的显示方法,其特征在于,所述根据配置表,在用户界面文件中构建控件,包括:2. The method for displaying a control according to claim 1, wherein constructing the control in the user interface file according to the configuration table comprises: 通过目标编程语言的目标库从所述配置表中读取控件配置数据,并根据所述控件配置数据,生成目标对象;Reading control configuration data from the configuration table through a target library of a target programming language, and generating a target object according to the control configuration data; 对所述目标对象进行预处理,确定图形界面、每个所述图形界面中的控件排序;Preprocessing the target object to determine a graphical interface and an order of controls in each graphical interface; 根据所述配置表中的界面元素类型,为每个所述图形界面中的界面元素匹配标准控件;According to the interface element type in the configuration table, matching a standard control for each interface element in the graphical interface; 根据所述配置表中的属性和样式,为所述标准控件设置属性,并结合所述控件排序,构建控件。According to the properties and styles in the configuration table, properties are set for the standard controls, and controls are constructed in combination with the control sorting. 3.根据权利要求1所述的控件的显示方法,其特征在于,所述建立配置表,包括:3. The method for displaying a control according to claim 1, wherein the step of establishing a configuration table comprises: 确定配置表的组编码;所述组编码为一组图形界面,包括多个界面元素;所述组编码用于检索以获得一组图形界面的所有配置项;所述组编码还用于回调函数的函数名,以执行自定义功能;Determine a group code of the configuration table; the group code is a group of graphical interfaces, including multiple interface elements; the group code is used to retrieve to obtain all configuration items of a group of graphical interfaces; the group code is also used as a function name of a callback function to execute a custom function; 确定子类别;所述子类别用于对界面元素进行二次分组。Determine a subcategory; the subcategory is used to perform secondary grouping of interface elements. 4.根据权利要求3所述的控件的显示方法,其特征在于,所述方法还包括以下步骤:4. The method for displaying a control according to claim 3, characterized in that the method further comprises the following steps: 确定界面元素编码、界面元素类型和界面元素显示名;所述界面元素编码为当前界面元素在当前图形界面中的唯一码,所述界面元素编码用于回调函数的参数;所述界面元素类型包括文本框、下拉框、复选框;所述界面元素显示名为标签文本;Determine the interface element code, interface element type and interface element display name; the interface element code is the unique code of the current interface element in the current graphical interface, and the interface element code is used as a parameter of the callback function; the interface element type includes a text box, a drop-down box, and a check box; the interface element display name is a label text; 若当前界面元素类型为下拉框,确定值列表;所述值列表中的元素为所述下拉框的选项列表;If the current interface element type is a drop-down box, determine a value list; the elements in the value list are the option list of the drop-down box; 确定默认值和参数类型;所述参数类型用于表征界面元素是否需要传入回调函数。Determine the default value and parameter type; the parameter type is used to indicate whether the interface element needs to be passed into the callback function. 5.根据权利要求3所述的控件的显示方法,其特征在于,所述响应于对显示事件的触发操作,在目标区域中加载并显示所述控件,包括:5. The method for displaying a control according to claim 3, wherein in response to the triggering operation of the display event, loading and displaying the control in the target area comprises: 响应于对显示事件的触发操作,显示所述子类别对应的文本,并配置折叠按钮,以对该分组内的控件进行折叠或展开显示。In response to the triggering operation of the display event, the text corresponding to the subcategory is displayed, and a folding button is configured to fold or expand the controls in the group. 6.根据权利要求4所述的控件的显示方法,其特征在于,所述响应于对显示事件的触发操作,在目标区域中加载并显示所述控件,包括:6. The method for displaying a control according to claim 4, wherein in response to the triggering operation of the display event, loading and displaying the control in the target area comprises: 响应于对显示事件的触发操作,根据所述界面元素类型显示控件,并在当前控件的目标位置显示所述界面元素显示名;In response to a triggering operation of a display event, a control is displayed according to the interface element type, and a display name of the interface element is displayed at a target position of the current control; 若当前界面元素类型为下拉框,响应于对显示事件的触发操作,在所述下拉框的下拉选项中显示所述默认值;或者,若当前界面元素类型为输入框,响应于对显示事件的触发操作,在所述输入框的文本处显示所述默认值;或者,若当前界面元素类型为复选框,响应于对显示事件的触发操作,根据所述默认值,填充所述复选框的勾选项;If the current interface element type is a drop-down box, in response to a triggering operation on a display event, the default value is displayed in the drop-down options of the drop-down box; or, if the current interface element type is an input box, in response to a triggering operation on a display event, the default value is displayed in the text of the input box; or, if the current interface element type is a check box, in response to a triggering operation on a display event, the check option of the check box is filled according to the default value; 若当前参数类型为非参数,响应于对显示事件的触发操作,在当前控件的文本框中显示相应文本;或者,若当前参数类型为输入参数,响应于对显示事件的触发操作,根据所述界面元素编码和默认值,确定所述回调函数的输入参数,并在当前控件中显示默认值;或者,若当前参数类型为输出参数,响应于对显示事件的触发操作,接收所述回调函数的返回值,并在当前控件中进行显示。If the current parameter type is non-parameter, in response to the triggering operation of the display event, the corresponding text is displayed in the text box of the current control; or, if the current parameter type is an input parameter, in response to the triggering operation of the display event, the input parameter of the callback function is determined according to the interface element code and the default value, and the default value is displayed in the current control; or, if the current parameter type is an output parameter, in response to the triggering operation of the display event, the return value of the callback function is received and displayed in the current control. 7.根据权利要求2所述的控件的显示方法,其特征在于,所述响应于对显示事件的触发操作,在目标区域中加载并显示所述控件,包括:7. The method for displaying a control according to claim 2, wherein in response to a triggering operation of a display event, loading and displaying the control in a target area comprises: 响应于对显示事件的触发操作,将所述控件排序按照由大到小或由小到大的顺序在所述目标区域中由上至下加载控件;In response to a triggering operation of a display event, the controls are sorted in a descending order or a descending order and loaded from top to bottom in the target area; 或者,响应于对显示事件的触发操作,将所述控件排序按照由大到小或由小到大的顺序在所述目标区域中由左至右加载控件。Alternatively, in response to a triggering operation of a display event, the controls are sorted in a descending order or a descending order and loaded from left to right in the target area. 8.一种控件的显示系统,其特征在于,包括:8. A control display system, characterized by comprising: 第一模块,用于建立配置表;所述配置表用于表征用户界面元素的组合、属性、样式;The first module is used to establish a configuration table; the configuration table is used to represent the combination, attributes, and styles of user interface elements; 第二模块,用于根据配置表,在用户界面文件中构建控件;所述控件的参数由所述配置表确定,所述参数包括显示名称、类型、默认值;The second module is used to construct a control in the user interface file according to the configuration table; the parameters of the control are determined by the configuration table, and the parameters include display name, type, and default value; 第三模块,用于响应于对显示事件的触发操作,在目标区域中加载并显示所述控件。The third module is used to load and display the control in the target area in response to a triggering operation of a display event. 9.一种控件的显示装置,其特征在于,包括:9. A display device for a control, characterized by comprising: 至少一个处理器;at least one processor; 至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program; 当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1至7中任一项所述的控件的显示方法。When the at least one program is executed by the at least one processor, the at least one processor implements the method for displaying a control as described in any one of claims 1 to 7. 10.一种计算机可读存储介质,其中存储有处理器可执行的程序,其特征在于,所述处理器可执行的程序在由处理器执行时用于实现如权利要求1至7中任一项所述的控件的显示方法。10. A computer-readable storage medium storing a program executable by a processor, wherein the program executable by the processor is used to implement the display method of the control according to any one of claims 1 to 7 when executed by the processor.
CN202410792622.6A 2024-06-19 2024-06-19 A control display method, system, device and storage medium Pending CN118819517A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410792622.6A CN118819517A (en) 2024-06-19 2024-06-19 A control display method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410792622.6A CN118819517A (en) 2024-06-19 2024-06-19 A control display method, system, device and storage medium

Publications (1)

Publication Number Publication Date
CN118819517A true CN118819517A (en) 2024-10-22

Family

ID=93068660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410792622.6A Pending CN118819517A (en) 2024-06-19 2024-06-19 A control display method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN118819517A (en)

Similar Documents

Publication Publication Date Title
AU2019246901B2 (en) Graphical user interface that simplifies user creation of custom calculations for data visualizations
US11829575B1 (en) Workflow assembly tool and workflow model
CN114035773A (en) Configuration-based low-code form development method, system and device
CN100504766C (en) Method and computer system for realizing programming interface
US12190053B2 (en) Providing operations in accordance with worksheet relationships and data object relationships
Hui Learn R for applied statistics with data visualizations, regressions, and statistics
JP2012520509A (en) Rich website authoring and design
CN106293653B (en) Code processing method and device and computer readable medium
KR102016161B1 (en) Method and system for simplified knowledge engineering
US7899846B2 (en) Declarative model editor generation
US20250181826A1 (en) Displaying data dimension of a descendant worksheet and data from one or more non-direct ancestor worksheets of a client-side spreadsheet
US20070150821A1 (en) GUI-maker (data-centric automated GUI-generation)
Rossi et al. Model-based web application development
US7603332B2 (en) Devices, systems, and methods for mediated rule-based translation system configuration information
de Lange et al. Collaborative wireframing for model-driven web engineering
CN120335858A (en) Low-code toolbox dynamic registration method, system, device and storage medium
CN118819517A (en) A control display method, system, device and storage medium
US10915599B2 (en) System and method for producing transferable, modular web pages
Casalánguida et al. User interface design for responsive web applications
Puertas Data science tools
Dolog et al. Towards variability modelling for reuse in hypermedia engineering
US12547940B2 (en) Machine learning integration in low-code no-code application development
US20070153342A1 (en) Display and editing of documents described by schemas
CN121365647A (en) Document processing methods, apparatuses, electronic devices, computer-readable storage media, and computer program products
CN119739370A (en) Code generation method, system, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination