TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

New Releases | TSMaster Toolkit IDE Series 2 - Toolkit Minimalist Development Flow

This chapter continues with the second chapter of the TSMaster Toolbox IDE series, Python-based interface design. Let's take a look at how to do minimalist development of the toolkit in the TSMaster environment.

Table of Contents for this article
<\/path><\/svg>"},"container":".PostContent","no_headings_message":"\u672c\u9875\u672a\u627e\u5230\u6807\u9898\u3002","hierarchical_view":"yes","min_height":{"unit":"px","size":"","sizes":[]},"min_height_widescreen":{"unit":"px","size":"","sizes":[]},"min_height_laptop":{"unit":"px","size":"","sizes":[]},"min_height_tablet_extra":{"unit":"px","size":"","sizes":[]},"min_height_tablet":{"unit":"px","size":"","sizes":[]},"min_height_mobile_extra":{"unit":"px","size":"","sizes":[]},"min_height_mobile":{"unit":"px","size":"","sizes":[]}}" data-widget_type="table-of-contents.default">

I. Creating space

1. Check the Python environment for readiness

Open TSMaster, go to Tools-System Information-Python Environment Settings page, in which users can choose the default running environment of Python x86 and x64. The latest version of TSMaster supports x86 version and x64 version, which can be configured according to whether the Python program developed by TSMaster is 32-bit or 64-bit, and you just need to Depending on whether the Python program developed by TSMaster is 32-bit or 64-bit, you just need to configure the corresponding running environment.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process
We come to the x86 runtime environment configuration box, which by default shows the Python that comes with TSMaster, i.e. version 3.8.5, which shows the full program path.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

2. Configuration box button operation

There are 5 buttons on the right side of the configuration box. The 1st button, Select Python Environment, when clicked, will bring up a dialog box where you can select another Python path. For example, if you have installed Python version 3.9 locally, you can completely change TSMaster's Python environment to version 3.9, and you don't need to always use the Python version that comes with TSMaster. After selecting version 3.9 and clicking Open, you can see the prompt that you can use the latest Python interpreter after restarting TSMaster software, just follow the prompts to restart and reopen TSMaster again. go to Tools - System Information - Python Environment Settings, you can see the output of the Python command line, which will show the current version number of the Python and the compile time and other detailed information. time and other details.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process
The 2nd button, which opens the folder for the Python environment, will bring up the main folder for Python 3.9 when clicked.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process
The 3rd button, it is to re-install TSMaster support library for the current environment, if TSMaster has been updated with a new version, or the user accidentally deleted the package related files, then you need to go here to install the TSMaster support library. You can click to try, it will show TSMaster support package is installed.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process
The 4th button, which is the path to restore the default Python interpreter, can be clicked to switch to the initial default, which is Python 3.8.5, in one click.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

The 5th button, which is to test if TSMaster's support library is working properly, will print the name of the API function in the support library and other information when clicked. If the test is successful, the TSMaster support library is available.

3. Creating toolbox windows

Open the application, Toolbox Design and Development Environment, the first page is a list of existing toolboxes, click the "+" Add button on the toolbar to create a new toolbox. Enter the name of the toolbox. For example, toolbox, press enter and a new toolbox is created.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process
Double-click on the toolbox1 line to get to the area of the control code, which defines a class called toolbox1 that inherits from TSMaster's internal toolbox form, TSForm. there is only one line of initialization code, which is to set the Caption, indicating that this is an empty form. Clicking Run at the top, or F9, launches this code and creates an empty toolbox window.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

II. Modification of space attributes

Click on the Window button on the toolbar to launch the Interface Designer, and we'll start by implementing a simple function. For example, click the button to change the title bar of the form, to Hello World.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

Come to the Controls page, select the first line of the list Button, click, come to the form area, and then click to create a button, the button is in the selected state by default, press F11, or click on the right side of the properties, you will come to the control's Properties tab. The default name of this button is Button1, where there is a Name, change it to btnTitle and change its Caption to Set Title.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

If you need to preview the effect, you can go to the Configuration tab of the component window and see that there are two buttons for code generation, the first one generates the Python code only, the second one generates the code and then runs the window at the same time, and if you click on the second button, it will close the current editor.

III. Generating code

1. New property settings

Mainly divided into two pieces of content, the first is the init function, the second is a variety of user-defined to the toolkit code design area, you can see that the empty form of the code added to the window's attribute settings, as well as the creation of buttons and attribute settings and so on. It should be noted that, sandwiched between two lines of green comments in the code is automatically generated and controlled by the form designer, do not recommend that the user to modify their own, because any modification will be followed by the code generation again to cover.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

Here, it is recommended that you use a professional editing tool to edit externally, and the recommended tool here is VS Code.

2. Writing event handlers

First, in the initialization function, associate the button click event to an event handler function. We can start by defining this function in our code. For example, below the function body of the init function, go ahead and write def OnSetTitleClick. note, note that the first parameter of a UI event is always sender, the source of the event trigger, so functions of this type generally have at least one parameter.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

Next, you need to set self, that is, the Caption of this form in the processing function to Hello World, then this function is written. Finally, we just need to self.btnTitle OnClick event associated with OnSetTitleClick, the code is written.

TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

Back to TSMaster, after clicking on the edit box, we will see that the file will be refreshed to the latest state, then we can press F9 or click on the triangular start button to run the program, click on the triangular start button to run the program, you can see that the title bar of the window changes to Hello World, which is the minimalist design process of the toolbox.

IV. Stand-alone function of the toolbox

Let's go to VS Code and click on the arrow directly on the top right, at this point we can start by minimizing TSMaster, changing the workspace to Trust, and then clicking on the Run button on the top right, and you can see that VS Code directly calls Python and launches the toolkit.
TSMaster Toolkit IDE Series 2-Toolkit Minimalist Development Process

At this point the toolbox window is again running independently from the main TSMaster program, which is the standalone form of the toolbox window. This means that the toolbox window replaces the main TSMaster window as a standalone application, and TSMaster runs in the background, providing all possible support for the Python window, but all of TSMaster's built-in functionality is still available.

About More

Above is this chapter for you to introduce the simple design process of the TSMaster toolbox, more use of tutorials can be viewed on the B station video ~!

发表回复

en_USEnglish
×
×

产品入口: 产品添加到购物车

Download location

Please click the download button below to start experiencing the powerful TSMaster features. Thank you for your support!

Beta version updated weekly, full version updated monthly
Installation environment
  • 1
    Windows 7 SP1 or higher, supports Win10, and WIn11.

    Operating System

  • 2
    8GB

    random access memory (RAM)

  • 3
    At least 550MB of free space

    disk space

  • 4
    Dual-core (2-core) or higher

    CPU

Please ensure that your computer meets at least these requirements in order to install and run the TSMaster software successfully. If your computer does not meet these requirements, it may cause performance problems or not run the software properly. You may want to consider upgrading your hardware if you need smoother running features.