A method and related apparatus for detecting programming blocks
By detecting programming blocks in the non-visual workspace and displaying erroneous programming blocks by category in the graphical programming interface, the lag problem caused by high rendering pressure in the visual programming platform is solved, improving user experience and search efficiency.
Patent Information
- Application Number
- CN202411218874.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-08-30
AI Technical Summary
The large number of programming blocks in a visual programming platform leads to high rendering pressure, causing interface lag during user interaction and affecting user experience.
By detecting programming blocks in the invisible workspace, the rendering pressure on the visible workspace is reduced, and error programming blocks are displayed in the graphical programming interface according to error categories.
It avoids user interface lag, improves user experience and readability, and allows users to quickly find and modify erroneous programming blocks.
Smart Images

Figure CN119088375B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for detecting programming blocks. Background Technology
[0002] With the development of artificial intelligence technology, there are more and more visual programming platforms for programming beginners. Visual programming platforms encapsulate programming language interfaces in graphical programming blocks, allowing users to complete programming and obtain target programming files by building programming blocks.
[0003] In related technologies, the graphical programming interface of a visual programming platform has a visual workspace. The target programming file can be rendered through the visual workspace, and the multiple programming blocks included in the target programming file are visually presented in the visual workspace to ensure that users can intuitively understand and operate the programming blocks.
[0004] However, a target programming file typically contains a large number of programming blocks, placing a significant rendering burden on the visual workspace. Even after rendering the required programming blocks, it needs to respond in real-time to user interactions, such as adding or modifying existing blocks. The visual workspace must adjust and render the blocks accordingly, further increasing its rendering load. Moreover, adding new features to the visual programming platform can cause user interface lag, resulting in delays or stuttering in the visual workspace's response to user actions, leading to a poor user experience. Summary of the Invention
[0005] To address the aforementioned technical issues, this application provides a method for detecting programming blocks, which helps to prevent user interface lag during interaction with a visual programming platform and improves the user experience.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On one hand, embodiments of this application provide a method for detecting programming blocks, the method comprising:
[0008] Displays a graphical programming interface including a visual workspace for displaying multiple programming blocks included in the target programming file;
[0009] During the process of displaying the multiple programming blocks through the visible work area, the multiple programming blocks are detected through the invisible work area to obtain erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The invisible work area and the visible work area do not affect each other.
[0010] The graphical programming interface displays error programming blocks according to error categories, with error programming blocks belonging to the same category displayed in the same sub-area of the graphical programming interface.
[0011] On the other hand, embodiments of this application provide a detection device for programming blocks, the device comprising: a display unit and a detection unit;
[0012] The display unit is used to display a graphical programming interface including a visual workspace, the visual workspace being used to display multiple programming blocks included in the target programming file;
[0013] The detection unit is used to detect the multiple programming blocks through the non-visual working area during the process of displaying the multiple programming blocks through the visible working area, and to obtain the erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The non-visual working area and the visible working area do not affect each other.
[0014] The display unit is also used to display the error programming blocks in the graphical programming interface according to the error category, and error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface.
[0015] On the other hand, embodiments of this application provide a computer device, the computer device including a processor and a memory:
[0016] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0017] The processor is configured to execute the methods described above according to instructions in the computer program.
[0018] On the other hand, embodiments of this application provide a computer-readable storage medium for storing a computer program for performing the methods described above.
[0019] On the other hand, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods described above.
[0020] As can be seen from the above technical solution, a graphical programming interface is displayed, including a visual workspace that can display multiple programming blocks included in the target programming file. To reduce the load on the visual workspace, programming blocks are no longer detected based on the visual workspace itself. Instead, while the programming blocks are displayed in the visual workspace, the multiple programming blocks included in the target programming file are detected through a non-visual workspace to identify error programming blocks. The visual and non-visual workspaces do not interfere with each other, so detecting programming blocks through the non-visual workspace does not affect the rendering process of the visual workspace. Adding new features does not increase the burden on the visual workspace, avoiding user interface lag issues and improving the user experience. Furthermore, when displaying error programming blocks in the graphical programming interface, they can be displayed according to error category, so that error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface. This allows users to view error programming blocks of the same category together, improving readability and enhancing the user experience. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A schematic diagram illustrating an application scenario of a method for detecting programming blocks provided in this application embodiment;
[0023] Figure 2 A flowchart illustrating the method for detecting programming blocks provided in this application embodiment;
[0024] Figure 3 A schematic diagram of a graphical programming interface provided in an embodiment of this application;
[0025] Figure 4 A schematic diagram of a graphical programming interface provided in an embodiment of this application;
[0026] Figure 5 A schematic diagram of a detection control provided in an embodiment of this application;
[0027] Figure 6 A schematic diagram of an error programming block provided in an embodiment of this application;
[0028] Figure 7 A schematic diagram of an error programming block provided in an embodiment of this application;
[0029] Figure 8 A schematic diagram of an error programming block provided in an embodiment of this application;
[0030] Figure 9 A schematic diagram of an error programming block provided in an embodiment of this application;
[0031] Figure 10 A schematic diagram of an error control provided in an embodiment of this application;
[0032] Figure 11 A schematic diagram of a viewing control provided in an embodiment of this application;
[0033] Figure 12 This is a schematic diagram of an unobstructed area provided in an embodiment of this application;
[0034] Figure 13 This is a schematic diagram of an unobstructed area provided in an embodiment of this application;
[0035] Figure 14 A schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application;
[0036] Figure 15 A schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application;
[0037] Figure 16 A schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application;
[0038] Figure 17 A schematic diagram illustrating the relationship between programming blocks provided in an embodiment of this application;
[0039] Figure 18 A schematic diagram illustrating a method for detecting programming blocks provided in an embodiment of this application;
[0040] Figure 19 A schematic diagram of a detection device for programming blocks provided in an embodiment of this application;
[0041] Figure 20 This application provides a schematic diagram of the structure of a server according to an embodiment of the present application.
[0042] Figure 21 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0043] The embodiments of this application will now be described with reference to the accompanying drawings.
[0044] In related technologies, during the rendering of target programming files through the visual workspace, the rendering load on the visual workspace is relatively high, and this load increases as the number of programming blocks included in the target programming file increases. Furthermore, as the number of programming blocks increases, the probability of errors in the programming blocks also increases. It becomes more difficult for users to find each erroneous programming block (hereinafter referred to as erroneous programming block), and the time required to find erroneous programming blocks is longer, resulting in low efficiency in finding erroneous programming blocks. This, in turn, affects programming efficiency and leads to a poor user experience.
[0045] Therefore, to improve the user experience, a detection function can be added to the visual programming platform to help users automatically detect erroneous programming blocks. However, due to the high rendering load of the visual workspace, detecting programming blocks based on the visual workspace may cause user interface lag, resulting in a poor user experience. Moreover, after detecting erroneous programming blocks, there is no highly readable way to display them, further contributing to a poor user experience.
[0046] Based on this, embodiments of this application provide a method and related apparatus for detecting programming blocks. By detecting programming blocks in a non-visual workspace that does not interfere with the visible workspace's rendering process, user interface lag issues are avoided, improving the user experience. Furthermore, displaying error programming blocks according to error categories ensures that error programming blocks belonging to the same category are displayed in the same sub-area within the graphical programming interface. This allows users to view error programming blocks of the same category together, improving readability and enhancing the user experience.
[0047] The method for detecting programming blocks provided in this application can be applied to computer devices with the capability to detect programming blocks, such as terminal devices and servers.
[0048] Specifically, terminal devices can be desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Smart in-vehicle devices can be in-vehicle navigation terminals and in-vehicle computers, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc., but are not limited to these.
[0049] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal devices and servers can be connected directly or indirectly via wired or wireless communication; this application does not impose any restrictions on this.
[0050] To facilitate understanding of the programming block detection method provided in this application embodiment, the following example uses a server as the execution subject of the programming block detection method to illustrate the application scenarios of the programming block detection method.
[0051] See Figure 1 This figure is a schematic diagram illustrating an application scenario of a method for detecting programming blocks provided in an embodiment of this application. For example... Figure 1 As shown, this application scenario includes a terminal device 100, which is used to execute the detection method for programming blocks provided in this application.
[0052] The terminal device 100 is equipped with a visual programming platform, which encapsulates the programming language interface in graphical programming blocks. Users can complete programming by building programming blocks and obtain the programming files they need.
[0053] The visual programming platform has a graphical programming interface 110, which includes a visual workspace 120. The visual workspace 120 displays multiple programming blocks included in the target programming file, and rendering is performed through the visual workspace 120 to visually present the programming blocks in the target programming file to the user. This application embodiment does not specifically limit the graphical programming interface 110; it may also include a programming block list 130, allowing selection of programming blocks from the list, which can then be dragged and dropped into the visual workspace 120 for rendering.
[0054] Because the visual programming platform has added a detection function, to avoid further increasing the load on the visual workspace 120, the programming blocks are no longer detected based on the visual workspace 120. Instead, detection is performed during the display of the programming blocks in the visual workspace 120, i.e., during the rendering process in the visual workspace 120, through the invisible workspace (since the invisible workspace is invisible, it is not detected during...). Figure 1(As shown in the diagram) The target programming file includes multiple programming blocks, which are then inspected to identify erroneous programming blocks. The invisible workspace is a logical area or space within a visual programming platform used to organize and display programming elements (such as code blocks, controls, charts, etc.) as well as project-related files and resources. In other words, the invisible workspace is not responsible for rendering but for inspection. The invisible and visible workspaces are two functionally distinct workspaces. Therefore, the invisible workspace's inspection process does not affect the rendering of the visible workspace. The two workspaces are independent of each other, and thus, inspecting programming blocks through the invisible workspace does not affect the rendering process of the visible workspace. This eliminates the need to add new visible workspaces when adding new features, avoids user interface lag issues, and improves the user experience.
[0055] After inspecting multiple programming blocks through the invisible workspace, the resulting erroneous programming blocks are displayed through the graphical programming interface 110, such as... Figure 1 As shown, a pop-up window 140 is displayed on the graphical programming interface 110, through which error programming blocks are displayed. Furthermore, the error programming blocks are displayed according to error categories, such as... Figure 1 Error programming blocks are displayed according to the trigger group to which they belong. This ensures that error programming blocks of the same category are displayed in the same sub-area of the graphical programming interface 110, allowing users to view error programming blocks of the same category together, improving readability and enhancing the user experience.
[0056] The programming block detection method provided in this application embodiment can be executed by a terminal device. However, in other embodiments of this application, the server may also have similar functions to the terminal device to execute the programming block detection method provided in this application embodiment, or the terminal device and the server may jointly execute the programming block detection method provided in this application embodiment. This embodiment does not limit this.
[0057] The detection method for programming blocks provided in this application can be applied to various scenarios. The following two scenarios are used as examples for illustration.
[0058] Scenario 1: Visual programming scenario.
[0059] Visual programming platforms can be used to teach programming concepts. By intuitively understanding and manipulating programming blocks, students can grasp algorithms and logical thinking, lowering the barrier to entry for learning programming. Alternatively, in skills training, visual programming platforms can help trainees quickly master programming skills in specific fields, such as industrial automation control and smart home system design.
[0060] During the process of students or learners programming by building programming blocks, the programming block detection method provided in this application can help them quickly detect problematic programming blocks while learning on a visual programming platform, thereby helping them to understand the content more deeply and improving the user experience.
[0061] Scenario 2: User-generated content editor scenario in a game.
[0062] The game offers a User Generated Content (UGC) editor with visual programming capabilities. Through this editor, users can drag and drop modules to combine and assemble events, characters, actions, and more, creating game designs like building blocks, such as parkour, battle, and level-based games. The UGC editor greatly facilitates game scene construction, allowing users to easily design game environments and maps.
[0063] Although ordinary users who have never been exposed to programming languages can design games using a UGC editor, the probability of errors increases as the number of programming blocks increases. It is difficult for users to find the erroneous programming blocks one by one. Therefore, the UGC editor provided in this application embodiment has added a detection function to help users quickly detect problematic programming blocks, thereby helping them improve game development efficiency and user experience.
[0064] To avoid user interface lag issues, this embodiment detects programming blocks through a hidden workspace. The hidden and visible workspaces are independent of each other, ensuring that the detection process in the hidden workspace does not affect the rendering process of the visible workspace. Furthermore, error programming blocks are displayed according to error categories, ensuring that error programming blocks of the same category are displayed in the same sub-area within the graphical programming interface. This allows users to view error programming blocks of the same category together, improving readability and enhancing the user experience.
[0065] It should be noted that the above application scenarios are merely examples. The method for detecting programming blocks provided in this embodiment can also be applied to other scenarios, and is not limited here.
[0066] The following describes in detail a method for detecting programming blocks provided in this application through method embodiments.
[0067] See Figure 2 This figure is a schematic flowchart of the programming block detection method provided in an embodiment of this application. For ease of description, the following embodiments will still use a terminal device as the executing entity of the programming block detection method. Figure 2As shown, the detection method for the programming block includes the following steps S201-S203.
[0068] S201: Displays a graphical programming interface that includes a visual workspace.
[0069] The graphical programming interface (GUI) is the user interface of the entire programming environment, containing all the visual and functional elements needed for programming. GUI programming encapsulates programming languages within graphical programming blocks, allowing users to build programs by dragging and dropping these blocks. GUI programming is suitable for learning programming among teenagers or beginners.
[0070] The graphical programming interface includes a visual workspace that displays multiple programming blocks included in the target programming file. The display of these blocks is achieved through the rendering function of the visual workspace. Each programming block encapsulates a programming language, and different blocks can represent different programming concepts, such as variables, logical expressions, and loops. This application does not specifically limit the creation method of the visual workspace. Taking Blocly as an example of a visual programming platform, the visual workspace can be created by first creating a DOM element using the graphical programming interface, embedding the Blockly editor interface into the created DOM element, configuring editor options, and rendering the editor for user interaction. For example, after creating the DOM element, the Blockly.Inject() function is called to create the visual workspace, and subsequent visual workspace operations will default to using this visual workspace.
[0071] In this context, a DOM element is a single node in the DOM tree structure. The DOM tree is a tree-like structure representing a document, composed of different types of nodes (such as element nodes, attribute nodes, text nodes, etc.), with each node being a DOM element.
[0072] A target programming file is a programming file composed of one or more programming blocks. For example, a target programming file can be a programming file that the user is currently editing; the user can add programming blocks to the visual workspace by dragging and dropping to obtain a target programming file containing multiple programming blocks. Alternatively, a target programming file can be a pre-edited programming file, which can be imported using the import function provided by the visual programming platform for rendering in the visual workspace.
[0073] See Figure 3 This figure is a schematic diagram of a graphical programming interface provided in an embodiment of this application. Figure 3In this context, the interface displayed on the terminal device's screen is the graphical programming interface 310. The graphical programming interface 310 includes a visual workspace 320. The visual workspace 320 displays two programming blocks: a trigger block and programming blocks connected to the trigger block. The trigger block is set to "when the game starts," and the variables of the programming blocks connected to the trigger block are set to arbitrary values, meaning no parameters are input to the programming block. The trigger block serves as the starting point for code execution.
[0074] As one possible implementation, the graphical programming interface can also include a list of programming blocks. See also... Figure 3 The graphical programming interface 310 includes not only a visual workspace 320 but also a list of programming blocks 330. It should be noted that if the target programming file contains a large number of programming blocks, these blocks can be divided into multiple trigger groups. Each trigger group contains multiple programming blocks, and the visual workspace displays programming blocks belonging to one trigger group at a time. See also... Figure 3 If trigger group A is selected based on the programming block list 330, then Figure 3 The visual workspace 320 displays the multiple programming blocks included in trigger group A.
[0075] Furthermore, users can switch between different trigger groups. During the switching process, the visual programming platform deletes the programming blocks included in the old trigger group in the visual workspace and loads the programming blocks included in the new trigger group in the visual workspace. For example... Figure 4 As shown, if trigger group B is selected based on the programming block list 330, then Figure 4 The visual workspace 320 displays the multiple programming blocks included in trigger group B. Figure 4 In the example, trigger group B includes trigger blocks and programming blocks connected to the trigger blocks. The trigger block is set to "when the sky environment changes," and the variables of the programming blocks connected to the trigger blocks are set to arbitrary values, meaning no parameters are input to the programming blocks. Furthermore, multiple trigger blocks can exist simultaneously within the same trigger group.
[0076] It is understood that in the specific implementation of this application, if user-related information (such as imported target programming files) is involved, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0077] S202: During the process of displaying multiple programming blocks through the visible workspace, multiple programming blocks are detected through the invisible workspace to obtain erroneous programming blocks.
[0078] As mentioned above, to improve user experience, the visual programming platform has added a detection function to check for errors in the programming blocks. However, since the visual workspace faces significant rendering pressure, implementing the detection function based on the visual workspace could cause user interface lag, thus affecting the user experience.
[0079] Based on this, the embodiments of this application no longer perform the detection function based on the visible workspace, but instead create a new invisible workspace. The detection function is performed through the invisible workspace. That is, when multiple programming blocks are displayed through the visible workspace, if the visible workspace is rendering the programming blocks or responding to user interactions after displaying the programming blocks, etc., and the rendering pressure of the visible workspace is high, the multiple programming blocks are detected through the invisible workspace to obtain the erroneous programming blocks (i.e., the programming blocks that have errors).
[0080] The invisible workspace is not visible to the user, meaning it does not require rendering and therefore does not affect the rendering process of the visible workspace. In other words, the visible and invisible workspaces do not affect each other, thus eliminating the pressure of adding new visible workspaces when adding new features and avoiding user interface lag issues, thereby improving the user experience.
[0081] This application does not specifically limit the method of creating invisible workspaces. Taking the visual programming platform Blockly as an example, the constructor of the workspace can be called and the returned identifier of the invisible workspace can be saved. The constructor initializes a new instance of the Workspace class, which represents a container that can hold, organize, and manage code blocks. It includes various methods and properties for interacting with these code blocks, such as adding, removing, and searching code blocks, and monitoring code block events. The identifier of the invisible workspace is used to uniquely identify the invisible workspace. Subsequently, the instance corresponding to the created invisible workspace can be obtained by passing in the identifier of the invisible workspace, so that the detection function can be performed based on the obtained invisible workspace. For example, the getWorkspace function can be called and the identifier of the invisible workspace can be passed in to obtain the instance of the invisible workspace and then the detection function can be performed based on the invisible workspace.
[0082] The embodiments of this application do not specifically limit the detection method of the invisible working area. The following will be explained based on C1-C3, and will not be repeated here.
[0083] Furthermore, in this embodiment, not only can known errors be detected, such as connection logic errors between programming blocks, but also custom errors can be detected. Custom errors are errors added by users or platforms, such as when the input of a programming block has no other programming blocks connected to it, the programming block has an error. This error is an empty input, thereby achieving customized detection, that is, checking for custom errors, thereby further improving the accuracy of detection and improving the user experience.
[0084] This application does not specifically limit the timing of performing detection operations in the invisible work area. The following description uses two methods as examples.
[0085] Method one involves setting up error detection controls in the graphical programming interface. Responding to trigger actions on these controls, multiple programming blocks can be checked through a non-visual workspace. See also... Figure 5 This figure is a schematic diagram of a detection control provided in an embodiment of this application. If a user performs a trigger operation such as a single click or double click on the detection control 340, the terminal device responds by acquiring the trigger operation for the detection control and detects multiple programming blocks through the invisible workspace.
[0086] Wherein, "responding to" is used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed can be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0087] Method 2: The detection function is enabled by default. In response to the detection of programming blocks displayed in the visible workspace, the function checks the programming blocks in the invisible workspace to identify erroneous blocks. In other words, if the user has already built programming blocks, the function checks those blocks, eliminating the need for the user to actively enable the detection function and improve the user experience.
[0088] S203: Display error programming blocks according to error category in the graphical programming interface.
[0089] After inspecting multiple programming blocks in the invisible workspace and identifying erroneous blocks, these blocks can be displayed through a graphical programming interface (GUI). The erroneous blocks are categorized by the type of error that occurred within the programming block. This ensures that erroneous blocks belonging to the same category are displayed in the same sub-area within the GUI, allowing users to view them together, improving readability and enhancing the user experience.
[0090] This application does not specifically limit the categories, and those skilled in the art can set them according to actual needs. For example, error categories may include trigger group categories, error cause categories, and programming block categories. These will be described separately below.
[0091] Error category one displays error programming blocks according to trigger group category, thus ensuring that error programming blocks within the same trigger group are displayed in the same sub-area of the graphical programming interface. See also Figure 6 This figure is a schematic diagram of an error programming block provided in an embodiment of this application. Figure 6 In this system, error programming blocks are displayed according to trigger groups. For example, error programming blocks belonging to trigger group A are displayed below trigger group A, and error programming blocks belonging to trigger group B are displayed below trigger group B. Therefore, when programming blocks are displayed based on trigger groups in the visual workspace, error programming blocks are displayed based on trigger group categories, allowing for quick modification of error programming blocks based on trigger groups and improving the user experience.
[0092] Error category two displays error programming blocks according to their error cause category, thus ensuring that programming blocks with the same error cause are displayed in the same sub-area within the graphical programming interface. See also Figure 7 This figure is a schematic diagram of an error programming block provided in an embodiment of this application. Figure 7 In this system, error programming blocks are displayed according to their error reasons. For example, two error programming blocks may both have the error reason of invalid or missing parameters. This allows for quick identification of problems in target programming files with multiple error categories, improving the user experience.
[0093] Error category three displays error programming blocks according to their category, ensuring that error programming blocks of the same category are displayed in the same sub-area within the graphical programming interface. See also Figure 8 This figure is a schematic diagram of an error programming block provided in an embodiment of this application. Figure 8 In the interface, error programming blocks are displayed according to their categories. For example, error programming blocks belonging to the trigger block category are displayed below the trigger block category. This allows for quick identification of problematic programming blocks when inspecting target programming files, helping users improve their programming skills in a targeted manner and enhancing the user experience.
[0094] Therefore, by displaying error programming blocks according to different error categories, such as trigger group categories, error cause categories, and programming block categories, error programming blocks belonging to the same category can be displayed in the same sub-area of the graphical programming interface, helping users to view error programming blocks of the same category together, improving readability and user experience. Furthermore, different error categories can be set to address different use cases, further enhancing the user experience.
[0095] As can be seen from the above technical solution, a graphical programming interface is displayed, including a visual workspace that can display multiple programming blocks included in the target programming file. To reduce the load on the visual workspace, programming blocks are no longer detected based on the visual workspace itself. Instead, while the programming blocks are displayed in the visual workspace, the multiple programming blocks included in the target programming file are detected through a non-visual workspace to identify error programming blocks. The visual and non-visual workspaces do not interfere with each other, so detecting programming blocks through the non-visual workspace does not affect the rendering process of the visual workspace. Adding new features does not increase the burden on the visual workspace, avoiding user interface lag issues and improving the user experience. Furthermore, when displaying error programming blocks in the graphical programming interface, they can be displayed according to error category, so that error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface. This allows users to view error programming blocks of the same category together, improving readability and enhancing the user experience.
[0096] As one possible implementation, this application provides two specific implementations of S203, namely, the specific implementation of displaying error programming blocks according to error categories in the graphical programming interface. The first specific implementation is detailed in A1, and the second specific implementation is detailed in B1-B2.
[0097] The first specific implementation method: direct display.
[0098] A1: Displays error programming blocks in the error programming block display area of the graphical programming interface.
[0099] The error programming block display area is a portion of the graphical programming interface.
[0100] See Figure 9 This figure is a schematic diagram of an error programming block provided in an embodiment of this application. Figure 9 In the graphical programming interface, the error programming block display area 350, the visual work area 320, and the programming block list 330 are all directly displayed on the graphical programming interface.
[0101] Therefore, after detecting error programming blocks through the invisible workspace, the error programming blocks can be directly displayed on the graphical programming interface through the error programming block display area, making it convenient for users to view error programming blocks in real time. For example, while adjusting the target programming file, the error programming blocks can be modified simultaneously, improving the user experience.
[0102] The second specific implementation method: display after interaction.
[0103] B1: Display error controls in the graphical programming interface.
[0104] Error controls are used to indicate whether the target programming file contains error programming blocks.
[0105] See Figure 10 This figure is a schematic diagram of an error control provided in an embodiment of this application. Figure 10 The image shows an error control 360, which displays the number 2, indicating that the current target programming file contains two error programming blocks. In other words, the error control, combined with a number, not only indicates whether error programming blocks exist in the target programming file, but also displays the number of error programming blocks.
[0106] It should be noted that the embodiments of this application do not specifically limit the display form of the error control, such as error control combined with numbers, error control displayed with icons, etc., and those skilled in the art can set it according to actual needs.
[0107] B2: In response to receiving a trigger action for an error control, display error programming blocks in the graphical programming interface according to the error category.
[0108] After the user performs a triggering action such as clicking on the error control, the terminal device responds by receiving the triggering action for that error control and displays error programming blocks in the graphical programming interface according to the error category, such as... Figures 6-8 As shown in any embodiment.
[0109] Therefore, by setting an error control in the graphical programming interface, indicating whether the target programming file contains error programming blocks, and even how many error programming blocks exist, as much information related to error programming blocks can be provided as much as possible while occupying the smallest area of the graphical programming interface. This ensures that the visible workspace is displayed as much as possible within the limited display area of the graphical programming interface, while also notifying the user of the existence of error programming blocks. Furthermore, by interacting with the error control, more detailed information related to the error programming blocks can be displayed, thus improving the user experience.
[0110] This application does not specifically limit the display method of the error programming block in B2. For example, the error programming block can be displayed through various interactive methods such as pop-up windows, drawers, page jumps, and drop-down menus. Those skilled in the art can set it according to actual needs.
[0111] Taking a pop-up window as an example, in response to a trigger action on an error control, a pop-up window is displayed on the graphical programming interface. This pop-up window displays error programming blocks according to the error category. See also... Figure 10 In response to receiving a trigger operation for the error control, a pop-up window 370 is displayed on the graphical programming interface 310, through which the error programming block is displayed.
[0112] Therefore, displaying error programming blocks via pop-ups has the following advantages: (1) Pop-ups can appear promptly when needed by the user, directly attracting the user's attention and enabling the user to immediately see important information or perform necessary operations without having to search or browse in the graphical programming interface. (2) Pop-ups can also reduce page jumps, thereby maintaining the user's context on the current page, that is, after exiting the pop-up, the user can continue the previous operation. (3) Pop-ups can focus the user's attention to a certain extent, forcing the user to process the information or operation in the pop-up first, and then continue other tasks. (4) Pop-ups can be customized as needed, including size, style, content, etc., to adapt to different scenarios and needs.
[0113] As one possible implementation, after displaying the error programming block using the second specific implementation method described above, the required error programming block can be displayed in the visible workspace after the display of the error programming block is turned off. The following explanation continues using a pop-up window as an example.
[0114] This pop-up window not only displays the error programming block but also its corresponding view control. This view control is used to navigate to the visual workspace to view the corresponding error programming block. It should be noted that if there are multiple error programming blocks, each block can have its own view control, allowing for multiple view controls to be used to view the corresponding error programming block.
[0115] See Figure 11 This figure is a schematic diagram of a viewing control provided in an embodiment of this application. Figure 11 The system contains two error programming blocks, each corresponding to a view control. For example, the error programming block of trigger group A corresponds to view control 381, and the error programming block of trigger group B corresponds to view control 382.
[0116] If a user performs a trigger operation on the view control corresponding to the error programming block, the terminal device responds by receiving the trigger operation for that view control, closing the pop-up window in the graphical programming interface, and displaying the error programming block corresponding to that view control in the visual workspace.
[0117] See also Figure 11 If a user wants to view the error programming blocks belonging to trigger group A, they can perform a trigger operation on the viewing control 381. In response to the trigger operation on the viewing control 381, the terminal device closes the pop-up window 370 in the graphical programming interface 310, thereby displaying the portion obscured by the pop-up window 370, namely the visual workspace 310 and the programming block list 330. The error programming control corresponding to the viewing control 381, i.e., the error programming block belonging to trigger group A, is then displayed in the visual workspace 310.
[0118] The embodiments of this application are not specifically limited to the way error programming blocks are displayed in the visual work area. For example, the required error programming blocks can be displayed in the middle of the visual work area, or the required error programming blocks can be highlighted in the visual work area (e.g., by highlighting) to further improve viewing efficiency.
[0119] Therefore, by equipping each error programming block with a corresponding viewing control, users can jump to the visual workspace to view the corresponding error programming block. In other words, the pop-up window is closed in the graphical programming interface, and the error programming block corresponding to the selected viewing control is displayed in the visual workspace. This achieves the positioning and display of error programming blocks in the visual workspace, improving viewing efficiency and enhancing the user experience.
[0120] As one possible implementation, as mentioned above, the visual workspace can display programming blocks using trigger groups, meaning that programming blocks belonging to the same trigger group are simultaneously displayed within the visual workspace. However, if the error programming blocks are displayed using the second specific implementation method described above, the visual workspace will be obscured, making it impossible to determine which trigger group has already been rendered in the visual workspace. If the user chooses to view error programming blocks from other trigger groups, the visual workspace needs to re-render the programming blocks included in those other trigger groups, wasting rendering resources. The following explanation will continue using a pop-up window as an example.
[0121] Based on this, in the embodiments of this application, while displaying the pop-up window, the identifier of the trigger group will also be displayed. The trigger group is the trigger group displayed in the visual workspace, so that users can select to view the trigger group displayed in the visual workspace based on the identifier of the trigger group. At this time, there is no need to render again, and the waiting time is short.
[0122] If the user chooses to view other trigger groups, that is, trigger groups other than those displayed in the visual workspace, the visual workspace needs to render for the other trigger groups first. Not only does it take waiting for the rendering to complete, but if the user selects the trigger groups previously displayed in the visual workspace again, it will need to be rendered again. This results in multiple rendering cycles and a long waiting time.
[0123] The following example uses the visual workspace to display the first trigger group, which is one of the multiple trigger groups included in the target programming file.
[0124] If the visual workspace displays the programming blocks included in the first trigger group, then during the process of displaying the error programming blocks included in the target programming file through a pop-up window, the identifier of the first trigger group is displayed in the unobstructed area of the graphical programming interface. This identifier is used to uniquely identify the first trigger group.
[0125] The unobstructed area refers to the area that will not be obscured by pop-ups, error programming blocks, or other content, ensuring that the user can see the identifier of the first trigger group while viewing the error programming blocks. This application does not specifically limit the location of the unobstructed area; those skilled in the art can set it according to actual needs. For example, the unobstructed area can be displayed together with the error programming blocks on the pop-up window, such as... Figure 12 The unobstructed area shown is region 390, which is displayed on pop-up window 370. Alternatively, the unobstructed area can be displayed outside the pop-up window along with the visible work area, such as... Figure 13 The unobstructed area shown is region 390, which is located in the graphical programming interface 310 but not in the pop-up window 370.
[0126] Therefore, when displaying error programming blocks through interactive methods such as pop-ups, to avoid these methods obscuring the visible workspace and making it unclear which trigger group is displayed, the corresponding trigger group identifier (such as the identifier of the first trigger group) can be displayed in the non-obscured area of the graphical programming interface. This allows users to clearly identify the first trigger group displayed in the visible workspace, thus prioritizing the selection of error programming blocks from the first trigger group. This avoids multiple renderings, saves rendering resources, reduces the rendering pressure on the visible workspace, reduces user waiting time, and improves the user experience.
[0127] Furthermore, if a user selects to view the error programming blocks in the second trigger group, the user can execute a trigger operation on the viewing control of that error programming block. In response to receiving the trigger operation for the second trigger group, the terminal device clears the programming blocks included in the first trigger group from the visual workspace and then loads the programming blocks included in the second trigger group into the visual workspace. It can be understood that the programming blocks included in the second trigger group include the error programming blocks that the user wants to view. The second trigger group and the first trigger group are different trigger groups.
[0128] This application does not specifically limit the display method of error programming blocks in the visual work area. The following describes two display methods, taking the example of multiple error programming blocks.
[0129] Method 1: Highlight.
[0130] If a user wants to view one of a number of error programming blocks, i.e., the target error programming block, the user can perform a viewing operation on the target error programming block, such as clicking the viewing control corresponding to the target error programming block. The terminal device responds to receiving the viewing operation on the target error programming block and displays the target error programming block in the visual work area through a first display mode and displays the other programming blocks through a second display mode.
[0131] Among them, other programming blocks are programming blocks other than the target error programming block. For example, if the first trigger group includes 10 programming blocks, then the other programming blocks are the 9 programming blocks other than the target error programming block among the 10 programming blocks included in the first trigger group.
[0132] The first display mode and the second display mode are different. For example, the first display mode is highlighted, and the second display mode is not highlighted. Another example is that the first display mode is bold, and the second display mode is normal. Yet another example is that the first display mode displays colored text, and the second display mode displays black text, etc.
[0133] See Figure 14 This figure is a schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application. Figure 14 In this context, the target error programming block is a programming block connected to the trigger block "When the game starts". The display method of the target error programming block is different from that of the trigger block "When the game starts", thus highlighting the display of the target error programming block.
[0134] Therefore, the target error programming block and other programming blocks are displayed in the first display mode and the second display mode respectively. By distinguishing the target error programming block from other programming blocks, the target error programming block is highlighted in the visual work area so that users can quickly see the target error programming block, make it easy to modify, and improve the user experience.
[0135] Option 2: Center display.
[0136] If a user wants to view one of a number of error programming blocks, i.e., the target error programming block, the user can perform a viewing operation on the target error programming block, such as clicking the viewing control corresponding to the target error programming block. The terminal device responds to receiving the viewing operation on the target error programming block and displays the target error programming block in the central area of the visual workspace.
[0137] The central area refers to the area extending outwards from the center of the visible work area.
[0138] See Figure 15 This figure is a schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application. Figure 15 In the game, the target error programming block is a programming block connected to the trigger block "When the game starts". The target error programming block is displayed in the middle of the visible workspace, i.e., the central area, so that the user can see the target error programming block immediately.
[0139] Therefore, by displaying the target error programming block in the center of the visual workspace, the target error programming block can be highlighted in the visual workspace, so that users can quickly see the target error programming block, make it easy to modify, and improve the user experience.
[0140] It should be noted that multiple display modes can be used in combination. For example, in response to a viewing operation for a target error programming block, the target error programming block can be displayed in the central area of the visual workspace using a first display mode, while other programming blocks can be displayed using a second display mode.
[0141] See Figure 16 This figure is a schematic diagram illustrating a highlighted error programming block provided in an embodiment of this application. Figure 16 In the game, the target error programming block is a programming block connected to the trigger block "When the game starts". This target error programming block is displayed in the middle of the visible workspace, i.e., the central area, and is highlighted so that the user can see the target error programming block immediately.
[0142] As one possible implementation, this application does not specifically limit the number of visible workspaces created. For example, the number of invisible workspaces to be created is determined based on the number of programming blocks included in the target programming file. The more programming blocks included in the target programming file, the more invisible workspaces need to be created; that is, the larger the number of invisible workspaces created. The number of creations is the number of invisible workspaces created.
[0143] Therefore, after determining the number of invisible workspaces to be created based on the multiple programming blocks included in the target programming file, invisible workspaces that meet the creation number are created. This allows multiple programming blocks to be detected separately through more invisible workspaces when there are more programming blocks. In other words, each invisible workspace can detect the programming blocks it is responsible for and obtain the erroneous programming blocks, thereby improving the detection speed.
[0144] For example, if the visual workspace displays a large number of programming blocks, the number of invisible workspaces to be created can be determined based on this number. The more programming blocks displayed in the visual workspace, the more invisible workspaces need to be created, meaning a larger number of invisible workspaces need to be created. For instance, if the visual workspace displays programming blocks as trigger groups, already created invisible workspaces can be reused when the next trigger group is displayed, thereby improving detection speed while reducing the number of invisible workspaces created.
[0145] Therefore, the number of invisible workspaces can be determined by the number of programming blocks. By creating invisible workspaces that meet the detection requirements, the programming blocks can be quickly detected through multiple invisible workspaces, thereby improving detection efficiency.
[0146] The following describes the process of detecting programming blocks in the non-visual workspace. See C1-C3 for details.
[0147] C1: After clearing the programming blocks included in the (i-1)th trigger group in the invisible workspace, load the programming blocks included in the i-th trigger group.
[0148] As mentioned above, programming blocks can be displayed in the form of trigger groups. Similarly, they can also be detected through the invisible workspace in the form of trigger groups. That is, the invisible workspace detects multiple programming blocks included in the target programming file in units of trigger groups. After detecting the programming blocks included in the (i-1)th trigger group, it continues to detect the programming blocks included in the ith trigger group to ensure comprehensive detection.
[0149] In addition, the invisible workspace can be reused. After the invisible workspace detects the programming blocks included in the (i-1)th trigger group, the programming blocks included in the (i-1)th trigger group are cleared. The i-th trigger group is then loaded into the cleared invisible workspace so that the programming blocks included in the i-th trigger group can continue to be detected through this invisible workspace until all trigger groups included in the target programming file have been detected, resulting in multiple error programming blocks included in the target programming file.
[0150] Where i is a positive integer. It should be noted that when i is 1, there is no (i-1)th trigger group, so the clearing operation is not required.
[0151] C2: Retrieves the trigger blocks from the programming blocks included in the i-th trigger group.
[0152] As mentioned above, a trigger group can include one or more trigger blocks. Each trigger block is the starting point for code execution. Therefore, subsequent detection based on trigger blocks can detect multiple programming blocks included in the trigger group and avoid omissions.
[0153] Therefore, all trigger blocks included in the multiple programming blocks of the i-th trigger group are obtained so that detection can start based on the trigger blocks, avoiding omissions of the programming blocks included in the i-th trigger group and improving the detection coverage.
[0154] As one possible implementation, the trigger blocks included in the i-th trigger group can be put into an array, so that the array can be reused directly in the future (such as to count the number of error programming blocks), without having to obtain the trigger blocks again, thus reducing the amount of computation.
[0155] C3: Starting from the trigger block, detect the trigger block and its child blocks to obtain the error programming block.
[0156] A trigger block's child blocks are blocks connected to the trigger block and require data or instructions from their parent block to execute their function. For example, the first child block connected to a trigger block has the trigger block as its parent block. The parent block provides data or instructions to its child blocks. Child and parent blocks are relative concepts; a child block can also act as the parent block for other blocks, providing them with data or instructions. Each child block of a trigger block corresponds to one execution of code.
[0157] In other words, the parent block, also known as the container block, typically has one or more slots to receive other blocks (i.e., "child blocks") and defines how these child blocks are organized or executed. Child blocks, also known as slot blocks, are designed to be inserted into the slots of the container block. They can be simple commands (such as moving a character), conditional statements (if...then...), loops (such as repeating...), or variable assignments, etc.
[0158] In visual programming platforms, a parent block typically provides an organizational structure and control flow. The interaction and data flow between child blocks are based on programming logic and data flow. A parent block can receive and organize multiple child blocks, which are referred to as sibling blocks. However, these child blocks do not directly receive input from the parent block; instead, they collectively form a logical unit or execution sequence. Within this sequence, child blocks may receive some form of organization or control from the parent block (through its structure or location), but more importantly, they collaborate with each other based on programming logic. For example, if a parent block defines a flow control structure for the program (such as sequential execution, conditional statements, loops, etc.), then its child blocks will execute according to this structure. During this process, child blocks may receive data or instructions from other child blocks, or provide data or instructions to other child blocks, but this interaction is usually based on programming logic and data flow, rather than directly receiving input from the parent block.
[0159] See Figure 17 This figure is a schematic diagram illustrating the relationship between programming blocks provided in an embodiment of this application. Figure 17 In this code, five programming blocks constitute a single code execution, such as the content executed after "the sky environment changes." The connections represent the flow of data. The trigger block is the parent block of programming block 1 and programming block 2; programming block 1 and programming block 2 are the child blocks of the trigger block; programming block 1 and programming block 2 are sibling blocks; programming block 3 is a child block of programming block 1; programming block 1 is the parent block of programming block 3; programming block 4 is a child block of programming block 2; and programming block 2 is the parent block of programming block 4.
[0160] Therefore, starting from the trigger block, we inspect the trigger block and its child blocks, thereby inspecting all blocks under the trigger block, such as... Figure 17As shown, the four child blocks associated with the trigger block can all be considered as child blocks of the trigger block, and the five programming blocks constitute one code execution. This allows for the detection of all blocks under the trigger block. By traversing all trigger blocks in the i-th trigger group, all programming blocks in the i-th trigger group can be detected, and thus all trigger groups included in the target programming file can be detected, resulting in multiple error blocks within the target programming file.
[0161] Therefore, by clearing the programming blocks included in the (i-1)th trigger group in the invisible workspace, loading the programming blocks included in the ith trigger group, and checking the programming blocks included in the ith trigger group, the invisible workspace can be reused, reducing the creation process of the invisible workspace and improving detection efficiency. Furthermore, during the detection of the programming blocks included in the ith trigger group, the trigger blocks of the ith trigger group are first obtained. Using these trigger blocks as the starting point for detection, and based on the data flow relationship between the programming blocks, each block is checked sequentially, thus avoiding omissions in the detection of programming blocks in the ith trigger group and improving detection accuracy.
[0162] As one possible implementation, if the error to be detected is an input error, then if an input error exists in a sub-block, the sub-blocks after that sub-block do not need to be detected, that is, there is no need to traverse all the programming blocks included in the i-th trigger group.
[0163] Based on this, the embodiments of this application provide a specific implementation of C3, namely, starting from the trigger block, detecting the trigger block and its sub-blocks to obtain the error programming block. See C31-C32 for details.
[0164] C31: Starting with the trigger block, inspect the trigger block and its child blocks.
[0165] Starting with the trigger block, you can inspect the trigger block and its child blocks according to the data flow relationship, and continue with... Figure 17 For example, the trigger block can be detected first, then programming blocks 1 and 3, and then programming blocks 2 and 4. It is understandable that after detecting the trigger block, programming blocks 2 and 4 can be detected first, followed by programming blocks 1 and 3; this application does not specifically limit this.
[0166] C32: If the target sub-block in the child blocks of the trigger block has an input error, then the parent block of the target sub-block is identified as the erroneous programming block, and the detection of the child blocks of the target sub-block is stopped. The detection continues from the sibling blocks of the parent block of the target sub-block to obtain the erroneous programming block.
[0167] A trigger block has multiple child blocks. If one of the child blocks of the trigger block, i.e. the target child block, has an input error, it means that the parent block of the target child block made an error in the process of transmitting data. The parent block of the target child block is the error programming block. At this time, the detection of the branch where the target child block is located can be stopped. That is, there is no need to detect the child blocks of the target child block anymore. Instead, the detection continues from the sibling blocks of the parent block of the target child block. The error programming block is obtained by continuously detecting.
[0168] Continue with Figure 17 For example, if the target sub-block is programming block 3, and programming block 3 has an input error, then its parent block, programming block 1, is the erroneous programming block. At this point, the detection of the sub-blocks of programming block 3 (not shown in the diagram) is stopped. Instead, the detection begins with the sibling block of programming block 1, programming block 2, then programming block 4, and so on, until the erroneous programming blocks included in the target programming file are obtained.
[0169] Therefore, if the error to be detected is an input error, then if an input error exists in a sub-block, the sub-blocks after that sub-block do not need to be detected. That is, there is no need to traverse all the programming blocks included in the i-th trigger group, thereby improving detection efficiency by immediately stopping useless detection.
[0170] To facilitate a further understanding of the technical solutions provided in the embodiments of this application, the following description takes the execution subject of the programming block detection method provided in the embodiments of this application as a terminal device, and takes the customized detection of custom errors as an example to provide an overall exemplary introduction to the programming block detection method.
[0171] Among them, a custom error can be defined as an empty input error when the input of a programming block is not connected to other programming blocks, and its parent block is the error programming block.
[0172] See Figure 18 The figure is a schematic diagram of a method for detecting programming blocks provided in an embodiment of this application.
[0173] S1801: Displays a graphical programming interface.
[0174] When a user imports a target programming file through a visual programming platform, the platform displays a graphical programming interface. This interface has a visual workspace, which displays the programming blocks included in the first trigger group of the target programming file. Specifically, the visual workspace displays the programming blocks according to the trigger group, as detailed in S201.
[0175] The following describes the process of detecting erroneous programming blocks by examining multiple programming blocks in the non-visual workspace while displaying the target programming file through the visual workspace.
[0176] S1802: Create a non-visible workspace.
[0177] Create a hidden workspace to detect erroneous programming blocks among multiple programming blocks. Unlike the visible workspace, the hidden workspace is only used for detecting programming blocks and is invisible to the user, thus avoiding the consumption of rendering resources and preventing user interface lag. See S202 for details.
[0178] S1803: Import programming blocks into the invisible workspace.
[0179] After clearing the programming blocks included in the (i-1)th trigger group in the invisible workspace, load the programming blocks included in the ith trigger group, see C1 for details.
[0180] S1804: Get all trigger blocks.
[0181] Retrieve the trigger blocks from the programming blocks included in the i-th trigger group. For example, you can retrieve all trigger blocks in the currently invisible workspace (i.e., the top-level blocks). For instance, call Blockly's "getTopBlocks" function, which iterates through all programming blocks in the workspace, finds the top-level blocks without parent blocks, and returns them as a list, thus obtaining all trigger blocks. Store all trigger blocks in an array; see C2 for details.
[0182] S1805: Inspect programming blocks.
[0183] Starting with the trigger block, the algorithm checks the trigger block and its child blocks to obtain the error programming block, as detailed in C3. For example, define an algorithm to check if each programming block in the i-th trigger group contains an input error. This algorithm could be a depth-first search (DFS) algorithm, starting with each trigger block and checking it and all its child blocks for input errors. If an error is found, record it in a global error list, using the trigger block's identifier and the identifier of its child block as keys, stop checking the current path, and backtrack to the sibling block of that child block.
[0184] S1806: Determine whether all trigger groups have been detected. If yes, execute S1807; otherwise, execute S1803.
[0185] Repeatedly execute S1803-S1805, that is, continuously increment the value of i by 1, thereby realizing the detection of each trigger group included in the target programming file and achieving cyclic checking.
[0186] S1807: Display error controls in the graphical programming interface.
[0187] The error control indicates whether the target programming file contains erroneous programming blocks, and the number of such blocks. In other words, after checking all trigger groups, the number of erroneous programming blocks present in the target programming file is calculated, and this number is displayed in the error control. Figure 10 As shown, see B1 for details.
[0188] Understandably, when counting the number of erroneous programming blocks according to the trigger group, the array in S1804 can be reused to reduce the amount of calculation.
[0189] S1808: Pop-up window appears.
[0190] In response to a trigger action on an error control, a pop-up window is displayed on the graphical programming interface. This pop-up window displays error programming blocks according to error categories. Error programming blocks belonging to the same category are displayed in the same sub-area of the pop-up window. See B2 for details.
[0191] S1809: Get the trigger action for the target error programming control.
[0192] S1810: Determine whether to switch work areas. If yes, execute S1811; otherwise, execute S1812.
[0193] During the process of displaying error programming blocks via pop-up windows, the identifier of the first trigger group is displayed in the unobstructed area of the graphical programming interface, allowing users to prioritize selecting the error programming block in the first trigger currently displayed in the visible workspace, such as... Figure 12 or Figure 13 As shown.
[0194] However, it's also necessary to ensure users can view erroneous programming blocks from other trigger groups. Specifically, when a user clicks on a trigger group, it's determined whether a visual workspace switch is needed. This can be achieved by comparing the trigger groups displayed in the visual workspace with the clicked trigger group. If they are the same trigger group, then a visual workspace switch is unnecessary. If they are not the same trigger group, then a visual workspace switch is required. During a visual workspace switch, the programming blocks from the previous trigger group in the visual workspace need to be cleared, and then the programming blocks from the selected trigger group need to be loaded. This process can be achieved using Blockly's "clear" and "load" functions. The "clear" function clears all blocks in the workspace, completely emptying the current workspace and restoring it to its initial blank state. The "load" function loads externally defined program structures into the workspace. This typically involves parsing a file (such as XML) containing programming blocks and their connection information, and then recreating these programming blocks and their relationships in the Blockly workspace to restore or display an existing program.
[0195] S1811: Import the programming blocks included in a new trigger group into the visual workspace.
[0196] S1812: Highlight and center error programming blocks.
[0197] When the user clicks the view control corresponding to the target error programming block, the pop-up closes. Error programming blocks can be viewed as Scalable Vector Graphics (SVG) elements, allowing highlighting to be achieved by modifying the Cascading Style Sheets (CSS) classes of the SVG elements or by directly applying style rules to the SVG elements. For example, a specific class can be added to the error programming block that needs to be highlighted, and then the style of this class can be defined as highlighting in the CSS. Specifically, the target error programming block can be highlighted using Blockly's "Highlight" function.
[0198] Then, position or layout the highlighted error programming block within its parent element or container, centering it both top-wise and horizontally, to achieve centered display. For example, you can use the Workspace's CenterOnBlockByTopMiddle method to center the target error programming block, such as... Figure 16 As shown.
[0199] As can be seen from the above technical solutions, the embodiments of this application provide a method for detecting and prompting errors in programming blocks. This method creates a hidden workspace specifically for detecting errors in programming blocks, which can handle the inspection of a large number of programming blocks while avoiding interface lag and improving user experience. Furthermore, categorizing and displaying errors according to trigger groups and other types provides more user-friendly prompts, helping users quickly locate and correct errors, improving programming efficiency and accuracy. This offers a better user experience. In addition, a method for locating erroneous programming blocks is also provided, helping users quickly find the required erroneous programming blocks and achieve the effect of quickly repairing erroneous programming blocks.
[0200] In addition to the programming block detection method described above, this application also provides a corresponding programming block detection device so that the above programming block detection method can be applied and implemented in practice.
[0201] See Figure 19 This figure is a schematic diagram of the structure of a detection device for programming blocks provided in an embodiment of this application. Figure 19 As shown, the detection device 1900 for the programming blocks includes: a display unit 1901 and a detection unit 1902;
[0202] The display unit 1901 is used to display a graphical programming interface including a visual workspace, the visual workspace being used to display multiple programming blocks included in the target programming file;
[0203] The detection unit 1902 is used to detect the multiple programming blocks through the non-visual working area during the process of displaying the multiple programming blocks through the visible working area, and to obtain the erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The non-visual working area and the visible working area do not affect each other.
[0204] The display unit 1901 is also used to display the error programming blocks in the graphical programming interface according to the error category, and error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface.
[0205] As can be seen from the above technical solution, a graphical programming interface is displayed, including a visual workspace that can display multiple programming blocks included in the target programming file. To reduce the load on the visual workspace, programming blocks are no longer detected based on the visual workspace itself. Instead, while the programming blocks are displayed in the visual workspace, the multiple programming blocks included in the target programming file are detected through a non-visual workspace to identify error programming blocks. The visual and non-visual workspaces do not interfere with each other, so detecting programming blocks through the non-visual workspace does not affect the rendering process of the visual workspace. Adding new features does not increase the burden on the visual workspace, avoiding user interface lag issues and improving the user experience. Furthermore, when displaying error programming blocks in the graphical programming interface, they can be displayed according to error category, so that error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface. This allows users to view error programming blocks of the same category together, improving readability and enhancing the user experience.
[0206] As one possible implementation, the display unit 1901 is specifically used for:
[0207] An error control is displayed in the graphical programming interface. The error control is used to indicate whether the target programming file contains the error programming block.
[0208] In response to receiving a trigger operation for the error control, the error programming blocks are displayed in the graphical programming interface according to the error category.
[0209] As one possible implementation, the display unit 1901 is specifically used for:
[0210] In response to receiving a trigger operation for the error control, a pop-up window is displayed on the graphical programming interface, the pop-up window being used to display the error programming blocks according to the error category.
[0211] As one possible implementation, the pop-up window is also used to display a viewing control corresponding to the error programming block. The viewing control is used to jump to the visual workspace to view the corresponding error programming block. The display unit 1901 is also used for:
[0212] In response to receiving a trigger operation for the view control, the pop-up window is closed in the graphical programming interface, and the error programming block corresponding to the view control is displayed in the visual workspace.
[0213] As one possible implementation, if the visual workspace displays programming blocks included in the first trigger group, where the first trigger group is one of multiple trigger groups, then the display unit 1901 is further configured to:
[0214] During the process of displaying the error programming block through the pop-up window, the identifier of the first trigger group is displayed in the unobstructed area of the graphical programming interface.
[0215] As one possible implementation, if there are multiple error programming blocks, then the display unit 1901 is specifically used for:
[0216] In response to a viewing operation for a target error programming block, the target error programming block is displayed in the visual workspace using a first display mode, and other programming blocks are displayed using a second display mode. The first and second display modes are different, and the other programming blocks are programming blocks other than the target error programming block.
[0217] As one possible implementation, if there are multiple error programming blocks, then the display unit 1901 is specifically used for:
[0218] In response to a view operation for a target error programming block, the target error programming block is displayed in the central area of the visual workspace.
[0219] As one possible implementation, the error categories include trigger group categories, error cause categories, and programming block categories;
[0220] Among them, error programming blocks belonging to the same trigger group category belong to the same trigger group, error programming blocks belonging to the same error cause category have the same error, and error programming blocks belonging to the same programming block category have the same category.
[0221] As one possible implementation, the apparatus further includes a creation unit for:
[0222] The number of invisible workspaces created is determined based on the number of the plurality of programming blocks; the more programming blocks there are, the greater the number of workspaces created.
[0223] Create a number of invisible workspaces that meet the specified number of creation criteria; different invisible workspaces are used to detect different programming blocks.
[0224] The detection unit 1902 is specifically used for:
[0225] The error programming block is obtained by detecting the corresponding programming block in each of the invisible work areas.
[0226] As one possible implementation, the detection unit 1902 is specifically used for:
[0227] After clearing the programming blocks included in the (i-1)th trigger group in the invisible work area, the programming blocks included in the ith trigger group are loaded, where i is a positive integer;
[0228] Obtain the trigger blocks from the programming blocks included in the i-th trigger group;
[0229] Starting from the trigger block, the trigger block and its child blocks are detected to obtain the error programming block. The child blocks of the trigger block correspond to one code execution with the trigger block.
[0230] As one possible implementation, the detection unit 1902 is specifically used for:
[0231] Starting from the trigger block, detect the trigger block and its child blocks;
[0232] If the target sub-block in the child blocks of the trigger block has an input error, the parent block of the target sub-block is identified as the erroneous programming block, and the detection of the child blocks of the target sub-block is stopped. The detection continues from the sibling blocks of the parent block of the target sub-block to obtain the erroneous programming block.
[0233] This application also provides a computer device, which can be a server or a terminal device. The computer device provided in this application will be described below from a hardware implementation perspective. Figure 20 The diagram shown is a structural schematic of the server. Figure 21 The diagram shown is a structural schematic of the terminal device.
[0234] See Figure 20 This figure is a schematic diagram of a server structure provided in an embodiment of this application. The server 1400 can vary considerably due to different configurations or performance. It may include one or more processors 1422, such as a central processing unit (CPU), memory 1432, and one or more application programs 1442 or data storage media 1430 (e.g., one or more mass storage devices). The memory 1432 and storage media 1430 can be temporary or persistent storage. The program stored in the storage media 1430 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the server. Furthermore, the processor 1422 may be configured to communicate with the storage media 1430 and execute the series of instruction operations in the storage media 1430 on the server 1400.
[0235] Server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input / output interfaces 1458, and / or one or more operating systems 1441, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0236] The steps performed by the server in the above embodiments can be based on this Figure 20 The server structure shown.
[0237] The processor 1422 is used to perform the following steps:
[0238] Displays a graphical programming interface including a visual workspace for displaying multiple programming blocks included in the target programming file;
[0239] During the process of displaying the multiple programming blocks through the visible work area, the multiple programming blocks are detected through the invisible work area to obtain erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The invisible work area and the visible work area do not affect each other.
[0240] The graphical programming interface displays error programming blocks according to error categories, with error programming blocks belonging to the same category displayed in the same sub-area of the graphical programming interface.
[0241] Optionally, the processor 1422 may also execute method steps of any specific implementation of the programming block detection method in the embodiments of this application.
[0242] See Figure 21 This figure is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. The description will be based on a smartphone as an example. Figure 21 The diagram shown is a partial structural block diagram of the smartphone, which includes: a radio frequency (RF) circuit 1510, a memory 1520, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a Wi-Fi module 1570, a processor 1580, and a power supply 1590, among other components. Those skilled in the art will understand that... Figure 21 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0243] The following is combined Figure 21 A detailed introduction to the various components of a smartphone:
[0244] The RF circuit 1510 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 1580; in addition, it transmits uplink data to the base station.
[0245] The memory 1520 can be used to store software programs and modules, and the processor 1580 runs the software programs and modules stored in the memory 1520 to realize various functions and data processing of the smartphone.
[0246] Input unit 1530 can be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the smartphone. Specifically, input unit 1530 may include touch panel 1531 and other input devices 1532. Touch panel 1531, also known as a touch screen, can collect touch operations on or near the user and drive corresponding connected devices according to a pre-set program. In addition to touch panel 1531, input unit 1530 may also include other input devices 1532. Specifically, other input devices 1532 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0247] The display unit 1540 can be used to display information input by the user or information provided to the user, as well as various menus of the smartphone. The display unit 1540 may include a display panel 1541, which may optionally be configured as a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0248] Smartphones may also include at least one sensor 1550, such as a light sensor, a motion sensor, and other sensors. Other sensors that smartphones may also be equipped with, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be detailed here.
[0249] Audio circuit 1560, speaker 1561, and microphone 1562 provide an audio interface between the user and the smartphone. Audio circuit 1560 converts received audio data into electrical signals and transmits them to speaker 1561, where speaker 1561 converts them into sound signals for output. On the other hand, microphone 1562 converts collected sound signals into electrical signals, which are received by audio circuit 1560, converted into audio data, and then processed by processor 1580 before being transmitted via RF circuit 1510 to, for example, another smartphone, or the audio data can be output to memory 1520 for further processing.
[0250] The processor 1580 is the control center of the smartphone, connecting various parts of the smartphone through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 1520, and by calling data stored in the memory 1520. Optionally, the processor 1580 may include one or more processing units.
[0251] The smartphone also includes a power supply 1590 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1580 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0252] Although not shown, smartphones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0253] In this embodiment of the application, the memory 1520 included in the smartphone can store computer programs and transmit the computer programs to the processor.
[0254] The processor 1580 included in the smartphone can execute the detection method for programming blocks provided in the above embodiments according to the instructions in the computer program.
[0255] This application also provides a computer-readable storage medium for storing a computer program for executing the detection method of programming blocks provided in the above embodiments.
[0256] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the detection method for programming blocks provided in various optional implementations of the above aspects.
[0257] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk or optical disk, and other media that can store computer programs.
[0258] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0259] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0260] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0261] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for detecting programming blocks, characterized in that, The method includes: Displays a graphical programming interface including a visual workspace for displaying multiple programming blocks included in the target programming file; During the process of displaying the multiple programming blocks through the visible work area, the multiple programming blocks are detected through the invisible work area to obtain erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The invisible work area and the visible work area do not affect each other. An error control is displayed in the graphical programming interface. The error control is used to indicate whether the target programming file contains the error programming block. In response to receiving a trigger operation for the error control, a pop-up window is displayed on the graphical programming interface. The pop-up window is used to display the error programming blocks according to the error category. Error programming blocks belonging to the same category are displayed in the same sub-area of the graphical programming interface. If the visual workspace displays programming blocks included in the first trigger group, and the first trigger group is one of multiple trigger groups, then during the process of displaying the error programming block through the pop-up window, the identifier of the first trigger group is displayed in the unobstructed area of the graphical programming interface.
2. The method according to claim 1, characterized in that, The pop-up window is also used to display a viewing control corresponding to the error programming block. The viewing control is used to jump to the visual workspace to view the corresponding error programming block. The method further includes: In response to receiving a trigger operation for the view control, the pop-up window is closed in the graphical programming interface, and the error programming block corresponding to the view control is displayed in the visual workspace.
3. The method according to claim 1, characterized in that, If there are multiple error programming blocks, the method further includes: In response to a viewing operation for a target error programming block, the target error programming block is displayed in the visual workspace using a first display mode, and other programming blocks are displayed using a second display mode. The first and second display modes are different, and the other programming blocks are programming blocks other than the target error programming block.
4. The method according to claim 1, characterized in that, The feature is that, If there are multiple error programming blocks, the method further includes: In response to a view operation for a target error programming block, the target error programming block is displayed in the central area of the visual workspace.
5. The method according to claim 1, characterized in that, The error categories include trigger group categories, error cause categories, and programming block categories; Among them, error programming blocks belonging to the same trigger group category belong to the same trigger group, error programming blocks belonging to the same error cause category have the same error, and error programming blocks belonging to the same programming block category have the same category.
6. The method according to claim 1, characterized in that, The method further includes: The number of invisible workspaces created is determined based on the number of the plurality of programming blocks; the more programming blocks there are, the greater the number of workspaces created. Create a number of invisible workspaces that meet the specified number of creation criteria; different invisible workspaces are used to detect different programming blocks. The step of detecting erroneous programming blocks by examining the multiple programming blocks in a non-visual workspace includes: The error programming block is obtained by detecting the corresponding programming block in each of the aforementioned invisible work areas.
7. The method according to claim 1, characterized in that, The step of detecting erroneous programming blocks by examining the multiple programming blocks in a non-visual workspace includes: After clearing the programming blocks included in the (i-1)th trigger group in the invisible work area, the programming blocks included in the ith trigger group are loaded, where i is a positive integer; Obtain the trigger blocks from the programming blocks included in the i-th trigger group; Starting from the trigger block, the trigger block and its child blocks are detected to obtain the error programming block. The child blocks of the trigger block correspond to one code execution with the trigger block.
8. The method according to claim 7, characterized in that, The step of detecting the trigger block and its child blocks, starting from the trigger block, to obtain the error programming block includes: Starting from the trigger block, detect the trigger block and its child blocks; If the target sub-block in the child blocks of the trigger block has an input error, the parent block of the target sub-block is identified as the erroneous programming block, and the detection of the child blocks of the target sub-block is stopped. The detection continues from the sibling blocks of the parent block of the target sub-block to obtain the erroneous programming block.
9. A detection device for programming blocks, characterized in that, The device includes: a display unit and a detection unit; The display unit is used to display a graphical programming interface including a visual workspace, the visual workspace being used to display multiple programming blocks included in the target programming file; The detection unit is used to detect the multiple programming blocks through the non-visual working area during the process of displaying the multiple programming blocks through the visible working area, and to obtain the erroneous programming blocks. The erroneous programming blocks are programming blocks that have errors. The non-visual working area and the visible working area do not affect each other. The display unit is further configured to display an error control on the graphical programming interface, the error control indicating whether the target programming file contains the error programming block; in response to receiving a trigger operation for the error control, a pop-up window is displayed on the graphical programming interface, the pop-up window displaying the error programming blocks according to error categories, and error programming blocks belonging to the same category being displayed in the same sub-area of the graphical programming interface; If the visual workspace displays programming blocks included in the first trigger group, and the first trigger group is one of a plurality of trigger groups, then the display unit is further configured to display the identifier of the first trigger group in the non-obstructed area of the graphical programming interface during the process of displaying the error programming block through the pop-up window.
10. The apparatus according to claim 9, characterized in that, The pop-up window is also used to display a viewing control corresponding to the error programming block. The viewing control is used to jump to the visual workspace to view the corresponding error programming block. The display unit is also used for: In response to receiving a trigger operation for the view control, the pop-up window is closed in the graphical programming interface, and the error programming block corresponding to the view control is displayed in the visual workspace.
11. The apparatus according to claim 9, characterized in that, If there are multiple error programming blocks, then the display unit is specifically used for: In response to a viewing operation for a target error programming block, the target error programming block is displayed in the visual workspace using a first display mode, and other programming blocks are displayed using a second display mode. The first and second display modes are different, and the other programming blocks are programming blocks other than the target error programming block.
12. The apparatus according to claim 9, characterized in that, The feature is that, If there are multiple error programming blocks, then the display unit is specifically used for: In response to a view operation for a target error programming block, the target error programming block is displayed in the central area of the visual workspace.
13. The apparatus according to claim 9, characterized in that, The error categories include trigger group categories, error cause categories, and programming block categories; Among them, error programming blocks belonging to the same trigger group category belong to the same trigger group, error programming blocks belonging to the same error cause category have the same error, and error programming blocks belonging to the same programming block category have the same category.
14. The apparatus according to claim 9, characterized in that, The device further includes a creation unit for: The number of invisible workspaces created is determined based on the number of the plurality of programming blocks; the more programming blocks there are, the greater the number of workspaces created. Create a number of invisible workspaces that meet the specified number of creation criteria; different invisible workspaces are used to detect different programming blocks. The detection unit is specifically used for: The error programming block is obtained by detecting the corresponding programming block in each of the invisible work areas.
15. The apparatus according to claim 9, characterized in that, The detection unit is specifically used for: After clearing the programming blocks included in the (i-1)th trigger group in the invisible work area, the programming blocks included in the ith trigger group are loaded, where i is a positive integer; Obtain the trigger blocks from the programming blocks included in the i-th trigger group; Starting from the trigger block, the trigger block and its child blocks are detected to obtain the error programming block. The child blocks of the trigger block correspond to one code execution with the trigger block.
16. The apparatus according to claim 15, characterized in that, The detection unit is specifically used for: Starting from the trigger block, detect the trigger block and its child blocks; If the target sub-block in the child blocks of the trigger block has an input error, the parent block of the target sub-block is identified as the erroneous programming block, and the detection of the child blocks of the target sub-block is stopped. The detection continues from the sibling blocks of the parent block of the target sub-block to obtain the erroneous programming block.
17. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to perform the method according to any one of claims 1-8 according to the computer program.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-8.
19. A computer program product comprising a computer program, characterized in that, When it is run on a computer device, it causes the computer device to perform the method described in any one of claims 1-8.
Citation Information
Patent Citations
Error inspection method
CN101515249A
Code error positioning method and device, electronic equipment and storage medium
CN113778854A