├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── app.py ├── connection ├── connection.pro ├── connection_ui.ui ├── connectiondialog.cpp ├── connectiondialog.h └── main.cpp ├── release.py ├── screenshot.png ├── setup.py ├── snap └── snapcraft.yaml ├── tests.py └── uaclient ├── __init__.py ├── application_certificate_dialog.py ├── applicationcertificate_ui.py ├── applicationcertificate_ui.ui ├── connection_dialog.py ├── connection_ui.py ├── connection_ui.ui ├── graphwidget.py ├── mainwindow.py ├── mainwindow_ui.py ├── mainwindow_ui.ui ├── theme ├── __init__.py ├── breeze.qrc ├── breeze_resources.py ├── dark.qss ├── dark │ ├── branch_closed-on.svg │ ├── branch_closed.svg │ ├── branch_open-on.svg │ ├── branch_open.svg │ ├── checkbox_checked.svg │ ├── checkbox_checked_disabled.svg │ ├── checkbox_indeterminate.svg │ ├── checkbox_indeterminate_disabled.svg │ ├── checkbox_unchecked.svg │ ├── checkbox_unchecked_disabled.svg │ ├── close-hover.svg │ ├── close-pressed.svg │ ├── close.svg │ ├── down_arrow-hover.svg │ ├── down_arrow.svg │ ├── down_arrow_disabled.svg │ ├── hmovetoolbar.svg │ ├── hsepartoolbar.svg │ ├── left_arrow.svg │ ├── left_arrow_disabled.svg │ ├── radio_checked.svg │ ├── radio_checked_disabled.svg │ ├── radio_unchecked.svg │ ├── radio_unchecked_disabled.svg │ ├── right_arrow.svg │ ├── right_arrow_disabled.svg │ ├── sizegrip.svg │ ├── spinup_disabled.svg │ ├── stylesheet-branch-end-closed.svg │ ├── stylesheet-branch-end-open.svg │ ├── stylesheet-branch-end.svg │ ├── stylesheet-branch-more.svg │ ├── stylesheet-vline.svg │ ├── transparent.svg │ ├── undock-hover.svg │ ├── undock.svg │ ├── up_arrow-hover.svg │ ├── up_arrow.svg │ ├── up_arrow_disabled.svg │ ├── vmovetoolbar.svg │ └── vsepartoolbars.svg ├── light.qss └── light │ ├── branch_closed-on.svg │ ├── branch_closed.svg │ ├── branch_open-on.svg │ ├── branch_open.svg │ ├── checkbox_checked-hover.svg │ ├── checkbox_checked.svg │ ├── checkbox_checked_disabled.svg │ ├── checkbox_indeterminate-hover.svg │ ├── checkbox_indeterminate.svg │ ├── checkbox_indeterminate_disabled.svg │ ├── checkbox_unchecked-hover.svg │ ├── checkbox_unchecked_disabled.svg │ ├── close-hover.svg │ ├── close-pressed.svg │ ├── close.svg │ ├── down_arrow-hover.svg │ ├── down_arrow.svg │ ├── down_arrow_disabled.svg │ ├── hmovetoolbar.svg │ ├── hsepartoolbar.svg │ ├── left_arrow.svg │ ├── left_arrow_disabled.svg │ ├── radio_checked-hover.svg │ ├── radio_checked.svg │ ├── radio_checked_disabled.svg │ ├── radio_unchecked-hover.svg │ ├── radio_unchecked_disabled.svg │ ├── right_arrow.svg │ ├── right_arrow_disabled.svg │ ├── sizegrip.svg │ ├── spinup_disabled.svg │ ├── stylesheet-branch-end-closed.svg │ ├── stylesheet-branch-end-open.svg │ ├── stylesheet-branch-end.svg │ ├── stylesheet-branch-more.svg │ ├── stylesheet-vline.svg │ ├── transparent.svg │ ├── undock-hover.svg │ ├── undock.svg │ ├── up_arrow-hover.svg │ ├── up_arrow.svg │ ├── up_arrow_disabled.svg │ ├── vmovetoolbar.svg │ └── vsepartoolbars.svg └── uaclient.py /.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | MANIFEST 3 | .idea* 4 | htmlcov* 5 | _* 6 | !__init__.py 7 | docs/_* 8 | *.pyc 9 | dist 10 | *.old 11 | *.swp 12 | *.swo 13 | *.log 14 | t.py 15 | tmp 16 | old 17 | dist 18 | *.egg-info 19 | *.swp 20 | 21 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | env: 5 | - DISPLAY=:99.0 6 | before_install: 7 | - sh -e /etc/init.d/xvfb start 8 | install: 9 | - pip install pyqt5 10 | - pip install python-dateutil 11 | - pip install pytz 12 | - pip install lxml 13 | - pip install cryptography 14 | - git clone https://github.com/FreeOpcUa/python-opcua.git 15 | - git clone https://github.com/FreeOpcUa/opcua-widgets.git 16 | # command to run tests 17 | script: python3 tests.py 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | pyuic5 uaclient/mainwindow_ui.ui -o uaclient/mainwindow_ui.py 3 | pyuic5 uaclient/connection_ui.ui -o uaclient/connection_ui.py 4 | pyrcc5 uawidgets/resources.qrc -o uawidgets/resources.py 5 | run: 6 | PYTHONPATH=$(shell pwd) 7 | python3 app.py 8 | edit: 9 | qtcreator uaclient/mainwindow_ui.ui 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Simple OPC-UA GUI client. 2 | 3 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/FreeOpcUa/opcua-client-gui/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/FreeOpcUa/opcua-client-gui/?branch=master) 4 | [![Build Status](https://travis-ci.org/FreeOpcUa/opcua-client-gui.svg?branch=master)](https://travis-ci.org/FreeOpcUa/opcua-client-gui) 5 | [![Build Status](https://travis-ci.org/FreeOpcUa/opcua-widgets.svg?branch=master)](https://travis-ci.org/FreeOpcUa/opcua-widgets) 6 | 7 | Written using freeopcua python api and pyqt. Most needed functionalities are implemented including subscribing for data changes and events, write variable values listing attributes and references, and call methods. PR are welcome for any whished improvments 8 | 9 | It has also a contextual menu with a few usefull function like putting the mode id in clipboard or the entire browse path which can be used directly in you program: client.nodes.root.get_child(['0:Objects', '2:MyNode']) 10 | 11 | ![Screenshot](/screenshot.png?raw=true "Screenshot") 12 | 13 | What works: 14 | * connecting and disconnecting 15 | * browsing with icons per node types 16 | * showing attributes and references 17 | * subscribing to variable 18 | * available on pip: sudo pip install opcua-client 19 | * remember connections and show connection history 20 | * subscribing to events 21 | * write variable node values 22 | * gui for certificates 23 | * gui for encryption 24 | * call methods 25 | * plot method values 26 | * remember last browsed path and restore state 27 | 28 | TODO (listed after priority): 29 | 30 | * detect lost connection and automatically reconnect 31 | * gui for loging with certificate or user/password (can currently be done by writting them in uri) 32 | * Maybe read history 33 | * Something else? 34 | 35 | # How to Install 36 | 37 | *Note: PyQT 5 is required.* 38 | 39 | ### Linux: 40 | 41 | 1. Make sure python and python-pip is installed 42 | 2. `pip3 install opcua-client` 43 | 4. Run with: `opcua-client` 44 | 45 | ### Windows: 46 | 47 | 1. Install winpython https://winpython.github.io/ , install the version including pyqt5! 48 | 3. Use pip to install opcua-client: `pip install opcua-client` 49 | 4. Run via the script pip created: `YOUR_INSTALL_PATH\Python\Python35\Scripts\opcua-client.exe` 50 | 51 | To update to the latest release run: `pip install opcua-client --upgrade` 52 | 53 | ### MacOS 54 | 55 | 1. Make sure python, python-pip and homebrew is installed 56 | 2. `brew install pyqt@5` 57 | 3. `pip3 install opcua-client pyqtgraph cryptography numpy` 58 | 4. Run with `opcua-client` 59 | 60 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from uaclient.mainwindow import main 2 | if __name__ == "__main__": 3 | main() 4 | -------------------------------------------------------------------------------- /connection/connection.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-12-07T13:23:10 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = connection 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp\ 16 | connectiondialog.cpp 17 | 18 | HEADERS += connectiondialog.h 19 | 20 | FORMS += connection_ui.ui 21 | -------------------------------------------------------------------------------- /connection/connection_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | ConnectionDialog 3 | 4 | 5 | 6 | 0 7 | 0 8 | 400 9 | 300 10 | 11 | 12 | 13 | ConnectionDialog 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /connection/connectiondialog.cpp: -------------------------------------------------------------------------------- 1 | #include "connectiondialog.h" 2 | #include "ui_connection_ui.h" 3 | 4 | ConnectionDialog::ConnectionDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::ConnectionDialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | ConnectionDialog::~ConnectionDialog() 12 | { 13 | delete ui; 14 | } 15 | -------------------------------------------------------------------------------- /connection/connectiondialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTIONDIALOG_H 2 | #define CONNECTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class ConnectionDialog; 8 | } 9 | 10 | class ConnectionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit ConnectionDialog(QWidget *parent = 0); 16 | ~ConnectionDialog(); 17 | 18 | private: 19 | Ui::ConnectionDialog *ui; 20 | }; 21 | 22 | #endif // CONNECTIONDIALOG_H 23 | -------------------------------------------------------------------------------- /connection/main.cpp: -------------------------------------------------------------------------------- 1 | #include "connectiondialog.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | ConnectionDialog w; 8 | w.show(); 9 | 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /release.py: -------------------------------------------------------------------------------- 1 | import re 2 | import os 3 | 4 | 5 | def bump_version(): 6 | with open("setup.py") as f: 7 | s = f.read() 8 | m = re.search(r'version="(.*)\.(.*)\.(.*)",', s) 9 | v1, v2, v3 = m.groups() 10 | oldv = "{}.{}.{}".format(v1, v2, v3) 11 | newv = "{}.{}.{}".format(v1, v2, str(int(v3) + 1)) 12 | print("Current version is: {}, write new version, ctrl-c to exit".format(oldv)) 13 | ans = input(newv) 14 | if ans: 15 | newv = ans 16 | s = s.replace(oldv, newv) 17 | with open("setup.py", "w") as f: 18 | f.write(s) 19 | return newv 20 | 21 | 22 | def release(): 23 | v = bump_version() 24 | ans = input("version bumped, commiting?(Y/n)") 25 | if ans in ("", "y", "yes"): 26 | os.system("git add setup.py") 27 | os.system("git commit -m 'new release'") 28 | os.system("git tag {}".format(v)) 29 | ans = input("change committed, push to server?(Y/n)") 30 | if ans in ("", "y", "yes"): 31 | os.system("git push") 32 | os.system("git push --tags") 33 | ans = input("upload to pip?(Y/n)") 34 | if ans in ("", "y", "yes"): 35 | os.system("rm -rf dist/*") 36 | os.system("python setup.py sdist bdist_wheel") 37 | os.system("twine upload dist/*") 38 | 39 | 40 | if __name__ == "__main__": 41 | release() 42 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/opcua-client-gui/240238d987b5030e175d8a987a6b4255d61146e0/screenshot.png -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | 4 | setup(name="opcua-client", 5 | version="0.8.4", 6 | description="OPC-UA Client GUI", 7 | author="Olivier R-D", 8 | url='https://github.com/FreeOpcUa/opcua-client-gui', 9 | packages=["uaclient", "uaclient.theme"], 10 | license="GNU General Public License", 11 | install_requires=["asyncua", "opcua-widgets>=0.6.0", "PyQt5"], 12 | entry_points={'console_scripts': 13 | ['opcua-client = uaclient.mainwindow:main'] 14 | } 15 | ) 16 | -------------------------------------------------------------------------------- /snap/snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: opcua-client 2 | version: v0.2 3 | summary: OPCUA Client GUI application 4 | description: | 5 | OPCUA Client GUI application using Python3/PyQt 6 | 7 | confinement: strict 8 | grade: stable 9 | base: core18 10 | 11 | parts: 12 | desktop-qt5: 13 | source: https://github.com/ubuntu/snapcraft-desktop-helpers.git 14 | source-subdir: qt 15 | plugin: make 16 | make-parameters: ["FLAVOR=qt5"] 17 | build-packages: 18 | - build-essential 19 | - qtbase5-dev 20 | - dpkg-dev 21 | stage-packages: 22 | - libxkbcommon0 23 | - ttf-ubuntu-font-family 24 | - dmz-cursor-theme 25 | - light-themes 26 | - adwaita-icon-theme 27 | - gnome-themes-standard 28 | - shared-mime-info 29 | - libqt5gui5 30 | - libgdk-pixbuf2.0-0 31 | - libqt5svg5 # for loading icon themes which are svg 32 | - try: [appmenu-qt5] # not available on core18 33 | - locales-all 34 | - xdg-user-dirs 35 | - fcitx-frontend-qt5 36 | 37 | opcua-client: 38 | plugin: python 39 | python-version: python3 40 | source: https://github.com/FreeOpcUa/opcua-client-gui.git 41 | stage-packages: 42 | - qt5-gtk-platformtheme 43 | - python3-pyqt5 44 | - qtwayland5 45 | - python3-pyqtgraph 46 | - python3-numpy 47 | python-packages: 48 | - cryptography 49 | after: [desktop-qt5] 50 | 51 | plugs: # plugs for theming, font settings, cursor and to use gtk3 file chooser 52 | gtk-3-themes: 53 | interface: content 54 | target: $SNAP/data-dir/themes 55 | default-provider: gtk-common-themes:gtk-3-themes 56 | icon-themes: 57 | interface: content 58 | target: $SNAP/data-dir/icons 59 | default-provider: gtk-common-themes:icon-themes 60 | sound-themes: 61 | interface: content 62 | target: $SNAP/data-dir/sounds 63 | default-provider: gtk-common-themes:sounds-themes 64 | 65 | apps: 66 | opcua-client: 67 | environment: 68 | DISABLE_WAYLAND: 1 69 | # Use GTK3 cursor theme, icon theme and open/save file dialogs. 70 | QT_QPA_PLATFORMTHEME: gtk3 71 | command: desktop-launch opcua-client 72 | plugs: [desktop, desktop-legacy, x11, unity7, wayland, opengl, network] 73 | -------------------------------------------------------------------------------- /tests.py: -------------------------------------------------------------------------------- 1 | 2 | import unittest 3 | import sys 4 | print("SYS:PATH", sys.path) 5 | sys.path.insert(0, "python-opcua") 6 | sys.path.insert(0, "opcua-widgets") 7 | import os 8 | print("PWD", os.getcwd()) 9 | 10 | from opcua import ua 11 | from opcua import Server 12 | 13 | from PyQt5.QtCore import QTimer, QSettings, QModelIndex, Qt, QCoreApplication 14 | from PyQt5.QtWidgets import QApplication 15 | from PyQt5.QtTest import QTest 16 | 17 | from uaclient.mainwindow import Window 18 | 19 | 20 | class TestClient(unittest.TestCase): 21 | def setUp(self): 22 | self.server = Server() 23 | url = "opc.tcp://localhost:48400/freeopcua/server/" 24 | self.server.set_endpoint(url) 25 | self.server.start() 26 | self.client = Window() 27 | self.client.ui.addrComboBox.setCurrentText(url) 28 | self.client.connect() 29 | 30 | def tearDown(self): 31 | self.client.disconnect() 32 | self.server.stop() 33 | 34 | def get_attr_value(self, text): 35 | idxlist = self.client.attrs_ui.model.match(self.client.attrs_ui.model.index(0, 0), Qt.DisplayRole, text, 1, Qt.MatchExactly | Qt.MatchRecursive) 36 | idx = idxlist[0] 37 | idx = idx.sibling(idx.row(), 1) 38 | item = self.client.attrs_ui.model.itemFromIndex(idx) 39 | return item.data(Qt.UserRole).value 40 | 41 | def test_select_objects(self): 42 | objects = self.server.nodes.objects 43 | self.client.tree_ui.expand_to_node(objects) 44 | self.assertEqual(objects, self.client.tree_ui.get_current_node()) 45 | self.assertGreater(self.client.attrs_ui.model.rowCount(), 6) 46 | self.assertGreater(self.client.refs_ui.model.rowCount(), 1) 47 | 48 | data = self.get_attr_value("NodeId") 49 | self.assertEqual(data, objects.nodeid) 50 | 51 | def test_select_server_node(self): 52 | server_node = self.server.nodes.server 53 | self.client.tree_ui.expand_to_node(server_node) 54 | self.assertEqual(server_node, self.client.tree_ui.get_current_node()) 55 | self.assertGreater(self.client.attrs_ui.model.rowCount(), 6) 56 | self.assertGreater(self.client.refs_ui.model.rowCount(), 10) 57 | 58 | data = self.get_attr_value("NodeId") 59 | self.assertEqual(data, server_node.nodeid) 60 | 61 | 62 | 63 | if __name__ == "__main__": 64 | app = QApplication(sys.argv) 65 | unittest.main() 66 | 67 | 68 | -------------------------------------------------------------------------------- /uaclient/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/opcua-client-gui/240238d987b5030e175d8a987a6b4255d61146e0/uaclient/__init__.py -------------------------------------------------------------------------------- /uaclient/application_certificate_dialog.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtWidgets import QDialog, QFileDialog 2 | 3 | from uaclient.applicationcertificate_ui import Ui_ApplicationCertificateDialog 4 | 5 | 6 | class ApplicationCertificateDialog(QDialog): 7 | def __init__(self, parent): 8 | QDialog.__init__(self) 9 | self.ui = Ui_ApplicationCertificateDialog() 10 | self.ui.setupUi(self) 11 | 12 | self.uaclient = parent.uaclient 13 | self.parent = parent 14 | 15 | self.ui.certificateLabel.setText(self.uaclient.application_certificate_path) 16 | self.ui.privateKeyLabel.setText(self.uaclient.application_private_key_path) 17 | 18 | self.ui.certificateButton.clicked.connect(self.get_certificate) 19 | self.ui.privateKeyButton.clicked.connect(self.get_private_key) 20 | 21 | @property 22 | def certificate_path(self): 23 | text = self.ui.certificateLabel.text() 24 | if text == "None": 25 | return None 26 | return text 27 | 28 | @certificate_path.setter 29 | def certificate_path(self, value): 30 | self.ui.certificateLabel.setText(value) 31 | 32 | @property 33 | def private_key_path(self): 34 | text = self.ui.privateKeyLabel.text() 35 | if text == "None": 36 | return None 37 | return text 38 | 39 | @private_key_path.setter 40 | def private_key_path(self, value): 41 | self.ui.privateKeyLabel.setText(value) 42 | 43 | def get_certificate(self): 44 | path, ok = QFileDialog.getOpenFileName(self, 45 | "Select application certificate", 46 | self.uaclient.application_certificate_path, 47 | "Certificate (*.der)") 48 | if ok: 49 | self.ui.certificateLabel.setText(path) 50 | 51 | def get_private_key(self): 52 | path, ok = QFileDialog.getOpenFileName(self, 53 | "Select application private key", 54 | self.uaclient.application_private_key_path, 55 | "Private key (*.pem)") 56 | if ok: 57 | self.ui.privateKeyLabel.setText(path) 58 | -------------------------------------------------------------------------------- /uaclient/applicationcertificate_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\uaclient\applicationcertificate_ui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ApplicationCertificateDialog(object): 15 | def setupUi(self, ApplicationCertificateDialog): 16 | ApplicationCertificateDialog.setObjectName("ApplicationCertificateDialog") 17 | ApplicationCertificateDialog.resize(504, 164) 18 | self.gridLayout = QtWidgets.QGridLayout(ApplicationCertificateDialog) 19 | self.gridLayout.setObjectName("gridLayout") 20 | spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 21 | self.gridLayout.addItem(spacerItem, 3, 0, 1, 3) 22 | self.privateKeyLabel = QtWidgets.QLabel(ApplicationCertificateDialog) 23 | self.privateKeyLabel.setObjectName("privateKeyLabel") 24 | self.gridLayout.addWidget(self.privateKeyLabel, 2, 0, 1, 2) 25 | self.privateKeyButton = QtWidgets.QPushButton(ApplicationCertificateDialog) 26 | self.privateKeyButton.setObjectName("privateKeyButton") 27 | self.gridLayout.addWidget(self.privateKeyButton, 2, 2, 1, 1) 28 | self.certificateLabel = QtWidgets.QLabel(ApplicationCertificateDialog) 29 | self.certificateLabel.setObjectName("certificateLabel") 30 | self.gridLayout.addWidget(self.certificateLabel, 1, 0, 1, 2) 31 | self.label_3 = QtWidgets.QLabel(ApplicationCertificateDialog) 32 | font = QtGui.QFont() 33 | font.setBold(True) 34 | font.setWeight(75) 35 | self.label_3.setFont(font) 36 | self.label_3.setObjectName("label_3") 37 | self.gridLayout.addWidget(self.label_3, 0, 0, 1, 2) 38 | self.certificateButton = QtWidgets.QPushButton(ApplicationCertificateDialog) 39 | self.certificateButton.setObjectName("certificateButton") 40 | self.gridLayout.addWidget(self.certificateButton, 1, 2, 1, 1) 41 | self.buttonBox = QtWidgets.QDialogButtonBox(ApplicationCertificateDialog) 42 | self.buttonBox.setOrientation(QtCore.Qt.Horizontal) 43 | self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) 44 | self.buttonBox.setObjectName("buttonBox") 45 | self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 3) 46 | 47 | self.retranslateUi(ApplicationCertificateDialog) 48 | self.buttonBox.accepted.connect(ApplicationCertificateDialog.accept) 49 | self.buttonBox.rejected.connect(ApplicationCertificateDialog.reject) 50 | QtCore.QMetaObject.connectSlotsByName(ApplicationCertificateDialog) 51 | 52 | def retranslateUi(self, ApplicationCertificateDialog): 53 | _translate = QtCore.QCoreApplication.translate 54 | ApplicationCertificateDialog.setWindowTitle(_translate("ApplicationCertificateDialog", "ApplicationCertificateDialog")) 55 | self.privateKeyLabel.setText(_translate("ApplicationCertificateDialog", "None")) 56 | self.privateKeyButton.setText(_translate("ApplicationCertificateDialog", "Select private key")) 57 | self.certificateLabel.setText(_translate("ApplicationCertificateDialog", "None")) 58 | self.label_3.setText(_translate("ApplicationCertificateDialog", "Application Authentication Settings:")) 59 | self.certificateButton.setText(_translate("ApplicationCertificateDialog", "Select certificate")) 60 | -------------------------------------------------------------------------------- /uaclient/applicationcertificate_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ApplicationCertificateDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 504 10 | 164 11 | 12 | 13 | 14 | ApplicationCertificateDialog 15 | 16 | 17 | 18 | 19 | 20 | Qt::Vertical 21 | 22 | 23 | 24 | 20 25 | 40 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | None 34 | 35 | 36 | 37 | 38 | 39 | 40 | Select private key 41 | 42 | 43 | 44 | 45 | 46 | 47 | None 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 75 56 | true 57 | 58 | 59 | 60 | Application Authentication Settings: 61 | 62 | 63 | 64 | 65 | 66 | 67 | Select certificate 68 | 69 | 70 | 71 | 72 | 73 | 74 | Qt::Horizontal 75 | 76 | 77 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | buttonBox 87 | accepted() 88 | ApplicationCertificateDialog 89 | accept() 90 | 91 | 92 | 248 93 | 254 94 | 95 | 96 | 157 97 | 274 98 | 99 | 100 | 101 | 102 | buttonBox 103 | rejected() 104 | ApplicationCertificateDialog 105 | reject() 106 | 107 | 108 | 316 109 | 260 110 | 111 | 112 | 286 113 | 274 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /uaclient/connection_dialog.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtWidgets import QDialog, QFileDialog 2 | 3 | from uaclient.connection_ui import Ui_ConnectionDialog 4 | from uawidgets.utils import trycatchslot 5 | 6 | 7 | class ConnectionDialog(QDialog): 8 | def __init__(self, parent, uri): 9 | QDialog.__init__(self) 10 | self.ui = Ui_ConnectionDialog() 11 | self.ui.setupUi(self) 12 | 13 | self.uaclient = parent.uaclient 14 | self.uri = uri 15 | self.parent = parent 16 | 17 | self.ui.modeComboBox.addItem("None") 18 | self.ui.modeComboBox.addItem("Sign") 19 | self.ui.modeComboBox.addItem("SignAndEncrypt") 20 | 21 | self.ui.policyComboBox.addItem("None") 22 | self.ui.policyComboBox.addItem("Basic128Rsa15") 23 | self.ui.policyComboBox.addItem("Basic256") 24 | 25 | self.ui.closeButton.clicked.connect(self.accept) 26 | self.ui.certificateButton.clicked.connect(self.get_certificate) 27 | self.ui.privateKeyButton.clicked.connect(self.get_private_key) 28 | self.ui.queryButton.clicked.connect(self.query) 29 | 30 | @trycatchslot 31 | def query(self): 32 | self.ui.modeComboBox.clear() 33 | self.ui.policyComboBox.clear() 34 | endpoints = self.parent.uaclient.get_endpoints(self.uri) 35 | modes = [] 36 | policies = [] 37 | for edp in endpoints: 38 | mode = edp.SecurityMode.name 39 | if mode not in modes: 40 | self.ui.modeComboBox.addItem(mode) 41 | modes.append(mode) 42 | policy = edp.SecurityPolicyUri.split("#")[1] 43 | if policy not in policies: 44 | self.ui.policyComboBox.addItem(policy) 45 | policies.append(policy) 46 | 47 | @property 48 | def security_mode(self): 49 | text = self.ui.modeComboBox.currentText() 50 | if text == "None": 51 | return None 52 | return text 53 | 54 | @security_mode.setter 55 | def security_mode(self, value): 56 | self.ui.modeComboBox.setCurrentText(value) 57 | 58 | @property 59 | def security_policy(self): 60 | text = self.ui.policyComboBox.currentText() 61 | if text == "None": 62 | return None 63 | return text 64 | 65 | @security_policy.setter 66 | def security_policy(self, value): 67 | self.ui.policyComboBox.setCurrentText(value) 68 | 69 | @property 70 | def certificate_path(self): 71 | return self.ui.certificateLabel.text() 72 | 73 | @certificate_path.setter 74 | def certificate_path(self, value): 75 | self.ui.certificateLabel.setText(value) 76 | 77 | @property 78 | def private_key_path(self): 79 | return self.ui.privateKeyLabel.text() 80 | 81 | @private_key_path.setter 82 | def private_key_path(self, value): 83 | self.ui.privateKeyLabel.setText(value) 84 | 85 | def get_certificate(self): 86 | path, ok = QFileDialog.getOpenFileName(self, "Select certificate", self.certificate_path, "Certificate (*.der)") 87 | if ok: 88 | self.ui.certificateLabel.setText(path) 89 | 90 | def get_private_key(self): 91 | path, ok = QFileDialog.getOpenFileName(self, "Select private key", self.private_key_path, "Private key (*.pem)") 92 | if ok: 93 | self.ui.privateKeyLabel.setText(path) 94 | 95 | 96 | -------------------------------------------------------------------------------- /uaclient/connection_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'uaclient/connection_ui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ConnectionDialog(object): 15 | def setupUi(self, ConnectionDialog): 16 | ConnectionDialog.setObjectName("ConnectionDialog") 17 | ConnectionDialog.resize(400, 300) 18 | self.gridLayout = QtWidgets.QGridLayout(ConnectionDialog) 19 | self.gridLayout.setContentsMargins(11, 11, 11, 11) 20 | self.gridLayout.setSpacing(6) 21 | self.gridLayout.setObjectName("gridLayout") 22 | self.queryButton = QtWidgets.QPushButton(ConnectionDialog) 23 | self.queryButton.setObjectName("queryButton") 24 | self.gridLayout.addWidget(self.queryButton, 0, 0, 1, 2) 25 | self.label = QtWidgets.QLabel(ConnectionDialog) 26 | self.label.setObjectName("label") 27 | self.gridLayout.addWidget(self.label, 1, 0, 1, 1) 28 | self.policyComboBox = QtWidgets.QComboBox(ConnectionDialog) 29 | self.policyComboBox.setObjectName("policyComboBox") 30 | self.gridLayout.addWidget(self.policyComboBox, 1, 1, 1, 2) 31 | self.label_2 = QtWidgets.QLabel(ConnectionDialog) 32 | self.label_2.setObjectName("label_2") 33 | self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) 34 | self.modeComboBox = QtWidgets.QComboBox(ConnectionDialog) 35 | self.modeComboBox.setObjectName("modeComboBox") 36 | self.gridLayout.addWidget(self.modeComboBox, 2, 1, 1, 2) 37 | self.certificateLabel = QtWidgets.QLabel(ConnectionDialog) 38 | self.certificateLabel.setObjectName("certificateLabel") 39 | self.gridLayout.addWidget(self.certificateLabel, 3, 0, 1, 1) 40 | self.certificateButton = QtWidgets.QPushButton(ConnectionDialog) 41 | self.certificateButton.setObjectName("certificateButton") 42 | self.gridLayout.addWidget(self.certificateButton, 3, 1, 1, 2) 43 | self.privateKeyLabel = QtWidgets.QLabel(ConnectionDialog) 44 | self.privateKeyLabel.setObjectName("privateKeyLabel") 45 | self.gridLayout.addWidget(self.privateKeyLabel, 4, 0, 1, 1) 46 | self.privateKeyButton = QtWidgets.QPushButton(ConnectionDialog) 47 | self.privateKeyButton.setObjectName("privateKeyButton") 48 | self.gridLayout.addWidget(self.privateKeyButton, 4, 1, 1, 2) 49 | self.closeButton = QtWidgets.QPushButton(ConnectionDialog) 50 | self.closeButton.setObjectName("closeButton") 51 | self.gridLayout.addWidget(self.closeButton, 5, 2, 1, 1) 52 | 53 | self.retranslateUi(ConnectionDialog) 54 | QtCore.QMetaObject.connectSlotsByName(ConnectionDialog) 55 | 56 | def retranslateUi(self, ConnectionDialog): 57 | _translate = QtCore.QCoreApplication.translate 58 | ConnectionDialog.setWindowTitle(_translate("ConnectionDialog", "ConnectionDialog")) 59 | self.queryButton.setText(_translate("ConnectionDialog", "Query server capability")) 60 | self.label.setText(_translate("ConnectionDialog", "Security Policy")) 61 | self.label_2.setText(_translate("ConnectionDialog", "Message Security Mode")) 62 | self.certificateLabel.setText(_translate("ConnectionDialog", "None")) 63 | self.certificateButton.setText(_translate("ConnectionDialog", "Select certificate")) 64 | self.privateKeyLabel.setText(_translate("ConnectionDialog", "None")) 65 | self.privateKeyButton.setText(_translate("ConnectionDialog", "Select private key")) 66 | self.closeButton.setText(_translate("ConnectionDialog", "Close")) 67 | -------------------------------------------------------------------------------- /uaclient/connection_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ConnectionDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | ConnectionDialog 15 | 16 | 17 | 18 | 19 | 20 | Query server capability 21 | 22 | 23 | 24 | 25 | 26 | 27 | Security Policy 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Message Security Mode 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | None 48 | 49 | 50 | 51 | 52 | 53 | 54 | Select certificate 55 | 56 | 57 | 58 | 59 | 60 | 61 | None 62 | 63 | 64 | 65 | 66 | 67 | 68 | Select private key 69 | 70 | 71 | 72 | 73 | 74 | 75 | Close 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /uaclient/graphwidget.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import logging 4 | from PyQt5.QtCore import QTimer, Qt 5 | from PyQt5.QtWidgets import QLabel 6 | 7 | from asyncua import ua 8 | from asyncua.sync import SyncNode 9 | 10 | from uawidgets.utils import trycatchslot 11 | 12 | use_graph = True 13 | try: 14 | import pyqtgraph as pg 15 | import numpy as np 16 | except ImportError: 17 | print("pyqtgraph or numpy are not installed, use of graph feature disabled") 18 | use_graph = False 19 | 20 | if use_graph: 21 | pg.setConfigOptions(antialias=True) 22 | pg.setConfigOption('background', 'w') 23 | pg.setConfigOption('foreground', 'k') 24 | 25 | logger = logging.getLogger(__name__) 26 | 27 | 28 | class GraphUI(object): 29 | 30 | # use tango color schema (public domain) 31 | colorCycle = ['#4e9a06ff', '#ce5c00ff', '#3465a4ff', '#75507bff', '#cc0000ff', '#edd400ff'] 32 | acceptedDatatypes = ['Decimal128', 'Double', 'Float', 'Integer', 'UInteger'] 33 | 34 | def __init__(self, window, uaclient): 35 | self.window = window 36 | self.uaclient = uaclient 37 | 38 | # exit if the modules are not present 39 | if not use_graph: 40 | self.window.ui.graphLayout.addWidget(QLabel("pyqtgraph or numpy not installed")) 41 | return 42 | self._node_list = [] # holds the nodes to poll 43 | self._channels = [] # holds the actual data 44 | self._curves = [] # holds the curve objects 45 | self.pw = pg.PlotWidget(name='Plot1') 46 | self.pw.showGrid(x=True, y=True, alpha=0.3) 47 | self.legend = self.pw.addLegend() 48 | self.window.ui.graphLayout.addWidget(self.pw) 49 | 50 | self.window.ui.actionAddToGraph.triggered.connect(self._add_node_to_channel) 51 | self.window.ui.actionRemoveFromGraph.triggered.connect(self._remove_node_from_channel) 52 | 53 | # populate contextual menu 54 | self.window.ui.treeView.addAction(self.window.ui.actionAddToGraph) 55 | self.window.ui.treeView.addAction(self.window.ui.actionRemoveFromGraph) 56 | 57 | # connect Apply button 58 | self.window.ui.buttonApply.clicked.connect(self.restartTimer) 59 | self.restartTimer() 60 | 61 | def restartTimer(self): 62 | # stop current timer, if it exists 63 | if hasattr(self, 'timer') and self.timer.isActive(): 64 | self.timer.stop() 65 | 66 | # define the number of polls displayed in graph 67 | self.N = self.window.ui.spinBoxNumberOfPoints.value() 68 | self.ts = np.arange(self.N) 69 | # define the poll intervall 70 | self.intervall = self.window.ui.spinBoxIntervall.value() * 1000 71 | 72 | # overwrite current channel buffers with zeros of current length and add to curves again 73 | for i, channel in enumerate(self._channels): 74 | self._channels[i] = np.zeros(self.N) 75 | self._curves[i].setData(self._channels[i]) 76 | 77 | # starting new timer 78 | self.timer = QTimer() 79 | self.timer.setInterval(self.intervall) 80 | self.timer.timeout.connect(self.pushtoGraph) 81 | self.timer.start() 82 | 83 | @trycatchslot 84 | def _add_node_to_channel(self, node=None): 85 | if not isinstance(node, SyncNode): 86 | node = self.window.get_current_node() 87 | if node is None: 88 | return 89 | if node not in self._node_list: 90 | dtype = node.read_attribute(ua.AttributeIds.DataType) 91 | 92 | dtypeStr = ua.ObjectIdNames[dtype.Value.Value.Identifier] 93 | 94 | if dtypeStr in self.acceptedDatatypes and not isinstance(node.get_value(), list): 95 | self._node_list.append(node) 96 | displayName = node.read_display_name().Text 97 | colorIndex = len(self._node_list) % len(self.colorCycle) 98 | self._curves.append \ 99 | (self.pw.plot(pen=pg.mkPen(color=self.colorCycle[colorIndex], width=3, style=Qt.SolidLine), name=displayName)) 100 | # set initial data to zero 101 | self._channels.append(np.zeros(self.N)) # init data sequence with zeros 102 | # add the new channel data to the new curve 103 | self._curves[-1].setData(self._channels[-1]) 104 | logger.info("Variable %s added to graph", displayName) 105 | 106 | else: 107 | logger.info("Variable cannot be added to graph because it is of type %s or an array", dtypeStr) 108 | 109 | @trycatchslot 110 | def _remove_node_from_channel(self, node=None): 111 | if not isinstance(node, SyncNode): 112 | node = self.window.get_current_node() 113 | if node is None: 114 | return 115 | if node in self._node_list: 116 | idx = self._node_list.index(node) 117 | self._node_list.pop(idx) 118 | displayName = node.read_display_name().Text 119 | self.legend.removeItem(displayName) 120 | self.pw.removeItem(self._curves[idx]) 121 | self._curves.pop(idx) 122 | self._channels.pop(idx) 123 | 124 | def pushtoGraph(self): 125 | # ringbuffer: shift and replace last 126 | for i, node in enumerate(self._node_list): 127 | self._channels[i] = np.roll(self._channels[i], -1) # shift elements to the left by one 128 | self._channels[i][-1] = float(node.get_value()) 129 | self._curves[i].setData(self.ts, self._channels[i]) 130 | 131 | def clear(self): 132 | pass 133 | 134 | def show_error(self, *args): 135 | self.window.show_error(*args) 136 | -------------------------------------------------------------------------------- /uaclient/mainwindow.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import sys 4 | 5 | from datetime import datetime 6 | import logging 7 | 8 | from PyQt5.QtCore import pyqtSignal, QFile, QTimer, Qt, QObject, QSettings, QTextStream, QItemSelection, \ 9 | QCoreApplication 10 | from PyQt5.QtGui import QStandardItemModel, QStandardItem, QIcon 11 | from PyQt5.QtWidgets import QMainWindow, QMessageBox, QWidget, QApplication, QMenu, QDialog 12 | 13 | from uaclient.theme import breeze_resources 14 | 15 | from asyncua import ua 16 | from asyncua.sync import SyncNode 17 | 18 | from uaclient.uaclient import UaClient 19 | from uaclient.mainwindow_ui import Ui_MainWindow 20 | from uaclient.connection_dialog import ConnectionDialog 21 | from uaclient.application_certificate_dialog import ApplicationCertificateDialog 22 | from uaclient.graphwidget import GraphUI 23 | 24 | from uawidgets import resources # must be here for ressources even if not used 25 | from uawidgets.attrs_widget import AttrsWidget 26 | from uawidgets.tree_widget import TreeWidget 27 | from uawidgets.refs_widget import RefsWidget 28 | from uawidgets.utils import trycatchslot 29 | from uawidgets.logger import QtHandler 30 | from uawidgets.call_method_dialog import CallMethodDialog 31 | 32 | 33 | logger = logging.getLogger(__name__) 34 | 35 | 36 | class DataChangeHandler(QObject): 37 | data_change_fired = pyqtSignal(object, str, str) 38 | 39 | def datachange_notification(self, node, val, data): 40 | if data.monitored_item.Value.SourceTimestamp: 41 | dato = data.monitored_item.Value.SourceTimestamp.isoformat() 42 | elif data.monitored_item.Value.ServerTimestamp: 43 | dato = data.monitored_item.Value.ServerTimestamp.isoformat() 44 | else: 45 | dato = datetime.now().isoformat() 46 | self.data_change_fired.emit(node, str(val), dato) 47 | 48 | 49 | class EventHandler(QObject): 50 | event_fired = pyqtSignal(object) 51 | 52 | def event_notification(self, event): 53 | self.event_fired.emit(event) 54 | 55 | 56 | class EventUI(object): 57 | 58 | def __init__(self, window, uaclient): 59 | self.window = window 60 | self.uaclient = uaclient 61 | self._handler = EventHandler() 62 | self._subscribed_nodes = [] # FIXME: not really needed 63 | self.model = QStandardItemModel() 64 | self.window.ui.evView.setModel(self.model) 65 | self.window.ui.actionSubscribeEvent.triggered.connect(self._subscribe) 66 | self.window.ui.actionUnsubscribeEvents.triggered.connect(self._unsubscribe) 67 | # context menu 68 | self.window.addAction(self.window.ui.actionSubscribeEvent) 69 | self.window.addAction(self.window.ui.actionUnsubscribeEvents) 70 | self.window.addAction(self.window.ui.actionAddToGraph) 71 | self._handler.event_fired.connect(self._update_event_model, type=Qt.QueuedConnection) 72 | 73 | # accept drops 74 | self.model.canDropMimeData = self.canDropMimeData 75 | self.model.dropMimeData = self.dropMimeData 76 | 77 | def canDropMimeData(self, mdata, action, row, column, parent): 78 | return True 79 | 80 | def show_error(self, *args): 81 | self.window.show_error(*args) 82 | 83 | def dropMimeData(self, mdata, action, row, column, parent): 84 | node = self.uaclient.client.get_node(mdata.text()) 85 | self._subscribe(node) 86 | return True 87 | 88 | def clear(self): 89 | self._subscribed_nodes = [] 90 | self.model.clear() 91 | 92 | @trycatchslot 93 | def _subscribe(self, node=None): 94 | logger.info("Subscribing to %s", node) 95 | if not node: 96 | node = self.window.get_current_node() 97 | if node is None: 98 | return 99 | if node in self._subscribed_nodes: 100 | logger.info("already subscribed to event for node: %s", node) 101 | return 102 | logger.info("Subscribing to events for %s", node) 103 | self.window.ui.evDockWidget.raise_() 104 | try: 105 | self.uaclient.subscribe_events(node, self._handler) 106 | except Exception as ex: 107 | self.window.show_error(ex) 108 | raise 109 | else: 110 | self._subscribed_nodes.append(node) 111 | 112 | @trycatchslot 113 | def _unsubscribe(self): 114 | node = self.window.get_current_node() 115 | if node is None: 116 | return 117 | self._subscribed_nodes.remove(node) 118 | self.uaclient.unsubscribe_events(node) 119 | 120 | @trycatchslot 121 | def _update_event_model(self, event): 122 | self.model.appendRow([QStandardItem(str(event))]) 123 | 124 | 125 | class DataChangeUI(object): 126 | 127 | def __init__(self, window, uaclient): 128 | self.window = window 129 | self.uaclient = uaclient 130 | self._subhandler = DataChangeHandler() 131 | self._subscribed_nodes = [] 132 | self.model = QStandardItemModel() 133 | self.window.ui.subView.setModel(self.model) 134 | self.window.ui.subView.horizontalHeader().setSectionResizeMode(1) 135 | 136 | self.window.ui.actionSubscribeDataChange.triggered.connect(self._subscribe) 137 | self.window.ui.actionUnsubscribeDataChange.triggered.connect(self._unsubscribe) 138 | 139 | # populate contextual menu 140 | self.window.addAction(self.window.ui.actionSubscribeDataChange) 141 | self.window.addAction(self.window.ui.actionUnsubscribeDataChange) 142 | 143 | # handle subscriptions 144 | self._subhandler.data_change_fired.connect(self._update_subscription_model, type=Qt.QueuedConnection) 145 | 146 | # accept drops 147 | self.model.canDropMimeData = self.canDropMimeData 148 | self.model.dropMimeData = self.dropMimeData 149 | 150 | def canDropMimeData(self, mdata, action, row, column, parent): 151 | return True 152 | 153 | def dropMimeData(self, mdata, action, row, column, parent): 154 | node = self.uaclient.client.get_node(mdata.text()) 155 | self._subscribe(node) 156 | return True 157 | 158 | def clear(self): 159 | self._subscribed_nodes = [] 160 | self.model.clear() 161 | 162 | def show_error(self, *args): 163 | self.window.show_error(*args) 164 | 165 | @trycatchslot 166 | def _subscribe(self, node=None): 167 | if not isinstance(node, SyncNode): 168 | node = self.window.get_current_node() 169 | if node is None: 170 | return 171 | if node in self._subscribed_nodes: 172 | logger.warning("allready subscribed to node: %s ", node) 173 | return 174 | self.model.setHorizontalHeaderLabels(["DisplayName", "Value", "Timestamp"]) 175 | text = str(node.read_display_name().Text) 176 | row = [QStandardItem(text), QStandardItem("No Data yet"), QStandardItem("")] 177 | row[0].setData(node) 178 | self.model.appendRow(row) 179 | self._subscribed_nodes.append(node) 180 | self.window.ui.subDockWidget.raise_() 181 | try: 182 | self.uaclient.subscribe_datachange(node, self._subhandler) 183 | except Exception as ex: 184 | self.window.show_error(ex) 185 | idx = self.model.indexFromItem(row[0]) 186 | self.model.takeRow(idx.row()) 187 | raise 188 | 189 | @trycatchslot 190 | def _unsubscribe(self): 191 | node = self.window.get_current_node() 192 | if node is None: 193 | return 194 | self.uaclient.unsubscribe_datachange(node) 195 | self._subscribed_nodes.remove(node) 196 | i = 0 197 | while self.model.item(i): 198 | item = self.model.item(i) 199 | if item.data() == node: 200 | self.model.removeRow(i) 201 | i += 1 202 | 203 | def _update_subscription_model(self, node, value, timestamp): 204 | i = 0 205 | while self.model.item(i): 206 | item = self.model.item(i) 207 | if item.data() == node: 208 | it = self.model.item(i, 1) 209 | it.setText(value) 210 | it_ts = self.model.item(i, 2) 211 | it_ts.setText(timestamp) 212 | i += 1 213 | 214 | 215 | class Window(QMainWindow): 216 | 217 | def __init__(self): 218 | QMainWindow.__init__(self) 219 | self.ui = Ui_MainWindow() 220 | self.ui.setupUi(self) 221 | self.setWindowIcon(QIcon(":/network.svg")) 222 | 223 | # fix stuff imposible to do in qtdesigner 224 | # remove dock titlebar for addressbar 225 | w = QWidget() 226 | self.ui.addrDockWidget.setTitleBarWidget(w) 227 | # tabify some docks 228 | self.tabifyDockWidget(self.ui.evDockWidget, self.ui.subDockWidget) 229 | self.tabifyDockWidget(self.ui.subDockWidget, self.ui.refDockWidget) 230 | self.tabifyDockWidget(self.ui.refDockWidget, self.ui.graphDockWidget) 231 | 232 | # we only show statusbar in case of errors 233 | self.ui.statusBar.hide() 234 | 235 | # setup QSettings for application and get a settings object 236 | QCoreApplication.setOrganizationName("FreeOpcUa") 237 | QCoreApplication.setApplicationName("OpcUaClient") 238 | self.settings = QSettings() 239 | 240 | self._address_list = self.settings.value("address_list", ["opc.tcp://localhost:4840", "opc.tcp://localhost:53530/OPCUA/SimulationServer/"]) 241 | print("ADR", self._address_list) 242 | self._address_list_max_count = int(self.settings.value("address_list_max_count", 10)) 243 | 244 | # init widgets 245 | for addr in self._address_list: 246 | self.ui.addrComboBox.insertItem(100, addr) 247 | 248 | self.uaclient = UaClient() 249 | 250 | self.tree_ui = TreeWidget(self.ui.treeView) 251 | self.tree_ui.error.connect(self.show_error) 252 | self.setup_context_menu_tree() 253 | self.ui.treeView.selectionModel().currentChanged.connect(self._update_actions_state) 254 | 255 | self.refs_ui = RefsWidget(self.ui.refView) 256 | self.refs_ui.error.connect(self.show_error) 257 | self.attrs_ui = AttrsWidget(self.ui.attrView) 258 | self.attrs_ui.error.connect(self.show_error) 259 | self.datachange_ui = DataChangeUI(self, self.uaclient) 260 | self.event_ui = EventUI(self, self.uaclient) 261 | self.graph_ui = GraphUI(self, self.uaclient) 262 | 263 | self.ui.addrComboBox.currentTextChanged.connect(self._uri_changed) 264 | self._uri_changed(self.ui.addrComboBox.currentText()) # force update for current value at startup 265 | 266 | self.ui.treeView.selectionModel().selectionChanged.connect(self.show_refs) 267 | self.ui.actionCopyPath.triggered.connect(self.tree_ui.copy_path) 268 | self.ui.actionCopyNodeId.triggered.connect(self.tree_ui.copy_nodeid) 269 | self.ui.actionCall.triggered.connect(self.call_method) 270 | 271 | self.ui.treeView.selectionModel().selectionChanged.connect(self.show_attrs) 272 | self.ui.attrRefreshButton.clicked.connect(self.show_attrs) 273 | 274 | self.resize(int(self.settings.value("main_window_width", 800)), int(self.settings.value("main_window_height", 600))) 275 | data = self.settings.value("main_window_state", None) 276 | if data: 277 | self.restoreState(data) 278 | 279 | self.ui.connectButton.clicked.connect(self.connect) 280 | self.ui.disconnectButton.clicked.connect(self.disconnect) 281 | # self.ui.treeView.expanded.connect(self._fit) 282 | 283 | self.ui.actionConnect.triggered.connect(self.connect) 284 | self.ui.actionDisconnect.triggered.connect(self.disconnect) 285 | 286 | self.ui.connectOptionButton.clicked.connect(self.show_connection_dialog) 287 | self.ui.actionClient_Application_Certificate.triggered.connect(self.show_application_certificate_dialog) 288 | self.ui.actionDark_Mode.triggered.connect(self.dark_mode) 289 | 290 | def _uri_changed(self, uri): 291 | self.uaclient.load_security_settings(uri) 292 | 293 | def show_connection_dialog(self): 294 | dia = ConnectionDialog(self, self.ui.addrComboBox.currentText()) 295 | dia.security_mode = self.uaclient.security_mode 296 | dia.security_policy = self.uaclient.security_policy 297 | dia.certificate_path = self.uaclient.user_certificate_path 298 | dia.private_key_path = self.uaclient.user_private_key_path 299 | ret = dia.exec_() 300 | if ret: 301 | self.uaclient.security_mode = dia.security_mode 302 | self.uaclient.security_policy = dia.security_policy 303 | self.uaclient.user_certificate_path = dia.certificate_path 304 | self.uaclient.user_private_key_path = dia.private_key_path 305 | 306 | def show_application_certificate_dialog(self): 307 | dia = ApplicationCertificateDialog(self) 308 | dia.certificate_path = self.uaclient.application_certificate_path 309 | dia.private_key_path = self.uaclient.application_private_key_path 310 | ret = dia.exec_() 311 | if ret == QDialog.Accepted: 312 | self.uaclient.application_certificate_path = dia.certificate_path 313 | self.uaclient.application_private_key_path = dia.private_key_path 314 | self.uaclient.save_application_certificate_settings() 315 | 316 | @trycatchslot 317 | def show_refs(self, selection): 318 | if isinstance(selection, QItemSelection): 319 | if not selection.indexes(): # no selection 320 | return 321 | 322 | node = self.get_current_node() 323 | if node: 324 | self.refs_ui.show_refs(node) 325 | 326 | @trycatchslot 327 | def show_attrs(self, selection): 328 | if isinstance(selection, QItemSelection): 329 | if not selection.indexes(): # no selection 330 | return 331 | 332 | node = self.get_current_node() 333 | if node: 334 | self.attrs_ui.show_attrs(node) 335 | 336 | def show_error(self, msg): 337 | logger.warning("showing error: %s") 338 | self.ui.statusBar.show() 339 | self.ui.statusBar.setStyleSheet("QStatusBar { background-color : red; color : black; }") 340 | self.ui.statusBar.showMessage(str(msg)) 341 | QTimer.singleShot(1500, self.ui.statusBar.hide) 342 | 343 | def get_current_node(self, idx=None): 344 | return self.tree_ui.get_current_node(idx) 345 | 346 | def get_uaclient(self): 347 | return self.uaclient 348 | 349 | @trycatchslot 350 | def connect(self): 351 | uri = self.ui.addrComboBox.currentText() 352 | uri = uri.strip() 353 | try: 354 | self.uaclient.connect(uri) 355 | except Exception as ex: 356 | self.show_error(ex) 357 | raise 358 | 359 | self._update_address_list(uri) 360 | self.tree_ui.set_root_node(self.uaclient.client.nodes.root) 361 | self.ui.treeView.setFocus() 362 | self.load_current_node() 363 | 364 | def _update_address_list(self, uri): 365 | if uri == self._address_list[0]: 366 | return 367 | if uri in self._address_list: 368 | self._address_list.remove(uri) 369 | self._address_list.insert(0, uri) 370 | if len(self._address_list) > self._address_list_max_count: 371 | self._address_list.pop(-1) 372 | 373 | def disconnect(self): 374 | try: 375 | self.uaclient.disconnect() 376 | except Exception as ex: 377 | self.show_error(ex) 378 | raise 379 | finally: 380 | self.save_current_node() 381 | self.tree_ui.clear() 382 | self.refs_ui.clear() 383 | self.attrs_ui.clear() 384 | self.datachange_ui.clear() 385 | self.event_ui.clear() 386 | 387 | 388 | def closeEvent(self, event): 389 | self.tree_ui.save_state() 390 | self.attrs_ui.save_state() 391 | self.refs_ui.save_state() 392 | self.settings.setValue("main_window_width", self.size().width()) 393 | self.settings.setValue("main_window_height", self.size().height()) 394 | self.settings.setValue("main_window_state", self.saveState()) 395 | self.settings.setValue("address_list", self._address_list) 396 | self.disconnect() 397 | event.accept() 398 | 399 | def save_current_node(self): 400 | current_node = self.tree_ui.get_current_node() 401 | if current_node: 402 | mysettings = self.settings.value("current_node", None) 403 | if mysettings is None: 404 | mysettings = {} 405 | uri = self.ui.addrComboBox.currentText() 406 | mysettings[uri] = current_node.nodeid.to_string() 407 | self.settings.setValue("current_node", mysettings) 408 | 409 | def load_current_node(self): 410 | mysettings = self.settings.value("current_node", None) 411 | if mysettings is None: 412 | return 413 | uri = self.ui.addrComboBox.currentText() 414 | if uri in mysettings: 415 | nodeid = ua.NodeId.from_string(mysettings[uri]) 416 | node = self.uaclient.client.get_node(nodeid) 417 | self.tree_ui.expand_to_node(node) 418 | 419 | def setup_context_menu_tree(self): 420 | self.ui.treeView.setContextMenuPolicy(Qt.CustomContextMenu) 421 | self.ui.treeView.customContextMenuRequested.connect(self._show_context_menu_tree) 422 | self._contextMenu = QMenu() 423 | self.addAction(self.ui.actionCopyPath) 424 | self.addAction(self.ui.actionCopyNodeId) 425 | self._contextMenu.addSeparator() 426 | self._contextMenu.addAction(self.ui.actionCall) 427 | self._contextMenu.addSeparator() 428 | 429 | def addAction(self, action): 430 | self._contextMenu.addAction(action) 431 | 432 | @trycatchslot 433 | def _update_actions_state(self, current, previous): 434 | node = self.get_current_node(current) 435 | self.ui.actionCall.setEnabled(False) 436 | if node: 437 | if node.read_node_class() == ua.NodeClass.Method: 438 | self.ui.actionCall.setEnabled(True) 439 | 440 | def _show_context_menu_tree(self, position): 441 | node = self.tree_ui.get_current_node() 442 | if node: 443 | self._contextMenu.exec_(self.ui.treeView.viewport().mapToGlobal(position)) 444 | 445 | def call_method(self): 446 | node = self.get_current_node() 447 | dia = CallMethodDialog(self, self.uaclient.client, node) 448 | dia.show() 449 | 450 | def dark_mode(self): 451 | self.settings.setValue("dark_mode", self.ui.actionDark_Mode.isChecked()) 452 | 453 | msg = QMessageBox() 454 | msg.setIcon(QMessageBox.Information) 455 | msg.setText("Restart for changes to take effect") 456 | msg.exec_() 457 | 458 | 459 | def main(): 460 | app = QApplication(sys.argv) 461 | client = Window() 462 | handler = QtHandler(client.ui.logTextEdit) 463 | logging.getLogger().addHandler(handler) 464 | logging.getLogger("uaclient").setLevel(logging.INFO) 465 | logging.getLogger("uawidgets").setLevel(logging.INFO) 466 | #logging.getLogger("opcua").setLevel(logging.INFO) # to enable logging of ua client library 467 | 468 | # set stylesheet 469 | if (QSettings().value("dark_mode", "false") == "true"): 470 | file = QFile(":/dark.qss") 471 | file.open(QFile.ReadOnly | QFile.Text) 472 | stream = QTextStream(file) 473 | app.setStyleSheet(stream.readAll()) 474 | 475 | client.show() 476 | sys.exit(app.exec_()) 477 | 478 | 479 | if __name__ == "__main__": 480 | main() 481 | -------------------------------------------------------------------------------- /uaclient/mainwindow_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'uaclient/mainwindow_ui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_MainWindow(object): 15 | def setupUi(self, MainWindow): 16 | MainWindow.setObjectName("MainWindow") 17 | MainWindow.resize(922, 879) 18 | icon = QtGui.QIcon() 19 | icon.addPixmap(QtGui.QPixmap("uaclient/../network.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 20 | MainWindow.setWindowIcon(icon) 21 | self.centralWidget = QtWidgets.QWidget(MainWindow) 22 | self.centralWidget.setObjectName("centralWidget") 23 | self.gridLayout_2 = QtWidgets.QGridLayout(self.centralWidget) 24 | self.gridLayout_2.setContentsMargins(11, 11, 11, 11) 25 | self.gridLayout_2.setSpacing(6) 26 | self.gridLayout_2.setObjectName("gridLayout_2") 27 | self.splitter = QtWidgets.QSplitter(self.centralWidget) 28 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 29 | sizePolicy.setHorizontalStretch(0) 30 | sizePolicy.setVerticalStretch(0) 31 | sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth()) 32 | self.splitter.setSizePolicy(sizePolicy) 33 | self.splitter.setOrientation(QtCore.Qt.Horizontal) 34 | self.splitter.setObjectName("splitter") 35 | self.treeView = QtWidgets.QTreeView(self.splitter) 36 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) 37 | sizePolicy.setHorizontalStretch(0) 38 | sizePolicy.setVerticalStretch(0) 39 | sizePolicy.setHeightForWidth(self.treeView.sizePolicy().hasHeightForWidth()) 40 | self.treeView.setSizePolicy(sizePolicy) 41 | self.treeView.setFocusPolicy(QtCore.Qt.StrongFocus) 42 | self.treeView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) 43 | self.treeView.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 44 | self.treeView.setDragEnabled(True) 45 | self.treeView.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly) 46 | self.treeView.setObjectName("treeView") 47 | self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1) 48 | MainWindow.setCentralWidget(self.centralWidget) 49 | self.menuBar = QtWidgets.QMenuBar(MainWindow) 50 | self.menuBar.setGeometry(QtCore.QRect(0, 0, 922, 24)) 51 | self.menuBar.setObjectName("menuBar") 52 | self.menuOPC_UA_Client = QtWidgets.QMenu(self.menuBar) 53 | self.menuOPC_UA_Client.setObjectName("menuOPC_UA_Client") 54 | self.menuSettings = QtWidgets.QMenu(self.menuBar) 55 | self.menuSettings.setObjectName("menuSettings") 56 | MainWindow.setMenuBar(self.menuBar) 57 | self.statusBar = QtWidgets.QStatusBar(MainWindow) 58 | self.statusBar.setObjectName("statusBar") 59 | MainWindow.setStatusBar(self.statusBar) 60 | self.attrDockWidget = QtWidgets.QDockWidget(MainWindow) 61 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 62 | sizePolicy.setHorizontalStretch(0) 63 | sizePolicy.setVerticalStretch(0) 64 | sizePolicy.setHeightForWidth(self.attrDockWidget.sizePolicy().hasHeightForWidth()) 65 | self.attrDockWidget.setSizePolicy(sizePolicy) 66 | self.attrDockWidget.setMinimumSize(QtCore.QSize(400, 170)) 67 | self.attrDockWidget.setObjectName("attrDockWidget") 68 | self.dockWidgetContents = QtWidgets.QWidget() 69 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 70 | sizePolicy.setHorizontalStretch(0) 71 | sizePolicy.setVerticalStretch(0) 72 | sizePolicy.setHeightForWidth(self.dockWidgetContents.sizePolicy().hasHeightForWidth()) 73 | self.dockWidgetContents.setSizePolicy(sizePolicy) 74 | self.dockWidgetContents.setMinimumSize(QtCore.QSize(100, 0)) 75 | self.dockWidgetContents.setObjectName("dockWidgetContents") 76 | self.gridLayout_4 = QtWidgets.QGridLayout(self.dockWidgetContents) 77 | self.gridLayout_4.setContentsMargins(11, 11, 11, 11) 78 | self.gridLayout_4.setSpacing(6) 79 | self.gridLayout_4.setObjectName("gridLayout_4") 80 | self.attrView = QtWidgets.QTreeView(self.dockWidgetContents) 81 | self.attrView.setFocusPolicy(QtCore.Qt.StrongFocus) 82 | self.attrView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) 83 | self.attrView.setEditTriggers(QtWidgets.QAbstractItemView.AllEditTriggers) 84 | self.attrView.setProperty("showDropIndicator", False) 85 | self.attrView.setTextElideMode(QtCore.Qt.ElideNone) 86 | self.attrView.setAutoExpandDelay(-1) 87 | self.attrView.setIndentation(18) 88 | self.attrView.setSortingEnabled(True) 89 | self.attrView.setWordWrap(True) 90 | self.attrView.setObjectName("attrView") 91 | self.gridLayout_4.addWidget(self.attrView, 0, 0, 1, 2) 92 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 93 | self.gridLayout_4.addItem(spacerItem, 1, 0, 1, 1) 94 | self.attrRefreshButton = QtWidgets.QPushButton(self.dockWidgetContents) 95 | self.attrRefreshButton.setObjectName("attrRefreshButton") 96 | self.gridLayout_4.addWidget(self.attrRefreshButton, 1, 1, 1, 1) 97 | self.attrDockWidget.setWidget(self.dockWidgetContents) 98 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.attrDockWidget) 99 | self.addrDockWidget = QtWidgets.QDockWidget(MainWindow) 100 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) 101 | sizePolicy.setHorizontalStretch(0) 102 | sizePolicy.setVerticalStretch(0) 103 | sizePolicy.setHeightForWidth(self.addrDockWidget.sizePolicy().hasHeightForWidth()) 104 | self.addrDockWidget.setSizePolicy(sizePolicy) 105 | self.addrDockWidget.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) 106 | self.addrDockWidget.setAllowedAreas(QtCore.Qt.TopDockWidgetArea) 107 | self.addrDockWidget.setObjectName("addrDockWidget") 108 | self.dockWidgetContents_2 = QtWidgets.QWidget() 109 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 110 | sizePolicy.setHorizontalStretch(0) 111 | sizePolicy.setVerticalStretch(0) 112 | sizePolicy.setHeightForWidth(self.dockWidgetContents_2.sizePolicy().hasHeightForWidth()) 113 | self.dockWidgetContents_2.setSizePolicy(sizePolicy) 114 | self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") 115 | self.gridLayout = QtWidgets.QGridLayout(self.dockWidgetContents_2) 116 | self.gridLayout.setContentsMargins(11, 11, 11, 11) 117 | self.gridLayout.setSpacing(6) 118 | self.gridLayout.setObjectName("gridLayout") 119 | self.connectButton = QtWidgets.QPushButton(self.dockWidgetContents_2) 120 | self.connectButton.setFocusPolicy(QtCore.Qt.StrongFocus) 121 | self.connectButton.setObjectName("connectButton") 122 | self.gridLayout.addWidget(self.connectButton, 1, 4, 1, 1) 123 | self.disconnectButton = QtWidgets.QPushButton(self.dockWidgetContents_2) 124 | self.disconnectButton.setFocusPolicy(QtCore.Qt.StrongFocus) 125 | self.disconnectButton.setObjectName("disconnectButton") 126 | self.gridLayout.addWidget(self.disconnectButton, 1, 5, 1, 1) 127 | self.addrComboBox = QtWidgets.QComboBox(self.dockWidgetContents_2) 128 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) 129 | sizePolicy.setHorizontalStretch(0) 130 | sizePolicy.setVerticalStretch(0) 131 | sizePolicy.setHeightForWidth(self.addrComboBox.sizePolicy().hasHeightForWidth()) 132 | self.addrComboBox.setSizePolicy(sizePolicy) 133 | self.addrComboBox.setEditable(True) 134 | self.addrComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop) 135 | self.addrComboBox.setObjectName("addrComboBox") 136 | self.gridLayout.addWidget(self.addrComboBox, 1, 2, 1, 1) 137 | self.connectOptionButton = QtWidgets.QPushButton(self.dockWidgetContents_2) 138 | self.connectOptionButton.setFocusPolicy(QtCore.Qt.StrongFocus) 139 | self.connectOptionButton.setObjectName("connectOptionButton") 140 | self.gridLayout.addWidget(self.connectOptionButton, 1, 3, 1, 1) 141 | self.addrDockWidget.setWidget(self.dockWidgetContents_2) 142 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(4), self.addrDockWidget) 143 | self.subDockWidget = QtWidgets.QDockWidget(MainWindow) 144 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 145 | sizePolicy.setHorizontalStretch(0) 146 | sizePolicy.setVerticalStretch(0) 147 | sizePolicy.setHeightForWidth(self.subDockWidget.sizePolicy().hasHeightForWidth()) 148 | self.subDockWidget.setSizePolicy(sizePolicy) 149 | self.subDockWidget.setObjectName("subDockWidget") 150 | self.dockWidgetContents_3 = QtWidgets.QWidget() 151 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 152 | sizePolicy.setHorizontalStretch(0) 153 | sizePolicy.setVerticalStretch(0) 154 | sizePolicy.setHeightForWidth(self.dockWidgetContents_3.sizePolicy().hasHeightForWidth()) 155 | self.dockWidgetContents_3.setSizePolicy(sizePolicy) 156 | self.dockWidgetContents_3.setObjectName("dockWidgetContents_3") 157 | self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_3) 158 | self.gridLayout_3.setContentsMargins(11, 11, 11, 11) 159 | self.gridLayout_3.setSpacing(6) 160 | self.gridLayout_3.setObjectName("gridLayout_3") 161 | self.subView = QtWidgets.QTableView(self.dockWidgetContents_3) 162 | self.subView.setFocusPolicy(QtCore.Qt.StrongFocus) 163 | self.subView.setAcceptDrops(True) 164 | self.subView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) 165 | self.subView.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 166 | self.subView.setTabKeyNavigation(False) 167 | self.subView.setDragDropOverwriteMode(False) 168 | self.subView.setDragDropMode(QtWidgets.QAbstractItemView.DropOnly) 169 | self.subView.setObjectName("subView") 170 | self.gridLayout_3.addWidget(self.subView, 0, 0, 1, 1) 171 | self.subDockWidget.setWidget(self.dockWidgetContents_3) 172 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.subDockWidget) 173 | self.refDockWidget = QtWidgets.QDockWidget(MainWindow) 174 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 175 | sizePolicy.setHorizontalStretch(0) 176 | sizePolicy.setVerticalStretch(0) 177 | sizePolicy.setHeightForWidth(self.refDockWidget.sizePolicy().hasHeightForWidth()) 178 | self.refDockWidget.setSizePolicy(sizePolicy) 179 | self.refDockWidget.setObjectName("refDockWidget") 180 | self.dockWidgetContents_4 = QtWidgets.QWidget() 181 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 182 | sizePolicy.setHorizontalStretch(0) 183 | sizePolicy.setVerticalStretch(0) 184 | sizePolicy.setHeightForWidth(self.dockWidgetContents_4.sizePolicy().hasHeightForWidth()) 185 | self.dockWidgetContents_4.setSizePolicy(sizePolicy) 186 | self.dockWidgetContents_4.setObjectName("dockWidgetContents_4") 187 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.dockWidgetContents_4) 188 | self.verticalLayout_2.setContentsMargins(11, 11, 11, 11) 189 | self.verticalLayout_2.setSpacing(6) 190 | self.verticalLayout_2.setObjectName("verticalLayout_2") 191 | self.refView = QtWidgets.QTableView(self.dockWidgetContents_4) 192 | self.refView.setFocusPolicy(QtCore.Qt.StrongFocus) 193 | self.refView.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 194 | self.refView.setTabKeyNavigation(False) 195 | self.refView.setObjectName("refView") 196 | self.verticalLayout_2.addWidget(self.refView) 197 | self.refDockWidget.setWidget(self.dockWidgetContents_4) 198 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.refDockWidget) 199 | self.evDockWidget = QtWidgets.QDockWidget(MainWindow) 200 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 201 | sizePolicy.setHorizontalStretch(0) 202 | sizePolicy.setVerticalStretch(0) 203 | sizePolicy.setHeightForWidth(self.evDockWidget.sizePolicy().hasHeightForWidth()) 204 | self.evDockWidget.setSizePolicy(sizePolicy) 205 | self.evDockWidget.setObjectName("evDockWidget") 206 | self.dockWidgetContents_5 = QtWidgets.QWidget() 207 | self.dockWidgetContents_5.setObjectName("dockWidgetContents_5") 208 | self.gridLayout_5 = QtWidgets.QGridLayout(self.dockWidgetContents_5) 209 | self.gridLayout_5.setContentsMargins(11, 11, 11, 11) 210 | self.gridLayout_5.setSpacing(6) 211 | self.gridLayout_5.setObjectName("gridLayout_5") 212 | self.evView = QtWidgets.QListView(self.dockWidgetContents_5) 213 | self.evView.setFocusPolicy(QtCore.Qt.StrongFocus) 214 | self.evView.setAcceptDrops(True) 215 | self.evView.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 216 | self.evView.setDragDropMode(QtWidgets.QAbstractItemView.DropOnly) 217 | self.evView.setObjectName("evView") 218 | self.gridLayout_5.addWidget(self.evView, 0, 0, 1, 1) 219 | self.evDockWidget.setWidget(self.dockWidgetContents_5) 220 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.evDockWidget) 221 | self.logDockWidget_2 = QtWidgets.QDockWidget(MainWindow) 222 | self.logDockWidget_2.setObjectName("logDockWidget_2") 223 | self.dockWidgetContents_7 = QtWidgets.QWidget() 224 | self.dockWidgetContents_7.setObjectName("dockWidgetContents_7") 225 | self.gridLayout_6 = QtWidgets.QGridLayout(self.dockWidgetContents_7) 226 | self.gridLayout_6.setContentsMargins(11, 11, 11, 11) 227 | self.gridLayout_6.setSpacing(6) 228 | self.gridLayout_6.setObjectName("gridLayout_6") 229 | self.logTextEdit = QtWidgets.QTextEdit(self.dockWidgetContents_7) 230 | self.logTextEdit.setFocusPolicy(QtCore.Qt.StrongFocus) 231 | self.logTextEdit.setTabChangesFocus(True) 232 | self.logTextEdit.setReadOnly(False) 233 | self.logTextEdit.setObjectName("logTextEdit") 234 | self.gridLayout_6.addWidget(self.logTextEdit, 0, 0, 1, 1) 235 | self.logDockWidget_2.setWidget(self.dockWidgetContents_7) 236 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.logDockWidget_2) 237 | self.graphDockWidget = QtWidgets.QDockWidget(MainWindow) 238 | self.graphDockWidget.setObjectName("graphDockWidget") 239 | self.dockWidgetContents_6 = QtWidgets.QWidget() 240 | self.dockWidgetContents_6.setObjectName("dockWidgetContents_6") 241 | self.gridLayout_7 = QtWidgets.QGridLayout(self.dockWidgetContents_6) 242 | self.gridLayout_7.setContentsMargins(11, 11, 11, 11) 243 | self.gridLayout_7.setSpacing(6) 244 | self.gridLayout_7.setObjectName("gridLayout_7") 245 | self.graphLayout = QtWidgets.QVBoxLayout() 246 | self.graphLayout.setSpacing(6) 247 | self.graphLayout.setObjectName("graphLayout") 248 | self.horizontalLayout = QtWidgets.QHBoxLayout() 249 | self.horizontalLayout.setSpacing(6) 250 | self.horizontalLayout.setObjectName("horizontalLayout") 251 | self.labelNumberOfPoints = QtWidgets.QLabel(self.dockWidgetContents_6) 252 | self.labelNumberOfPoints.setObjectName("labelNumberOfPoints") 253 | self.horizontalLayout.addWidget(self.labelNumberOfPoints) 254 | self.spinBoxNumberOfPoints = QtWidgets.QSpinBox(self.dockWidgetContents_6) 255 | self.spinBoxNumberOfPoints.setMinimum(10) 256 | self.spinBoxNumberOfPoints.setMaximum(100) 257 | self.spinBoxNumberOfPoints.setProperty("value", 30) 258 | self.spinBoxNumberOfPoints.setObjectName("spinBoxNumberOfPoints") 259 | self.horizontalLayout.addWidget(self.spinBoxNumberOfPoints) 260 | self.labelIntervall = QtWidgets.QLabel(self.dockWidgetContents_6) 261 | self.labelIntervall.setObjectName("labelIntervall") 262 | self.horizontalLayout.addWidget(self.labelIntervall) 263 | self.spinBoxIntervall = QtWidgets.QSpinBox(self.dockWidgetContents_6) 264 | self.spinBoxIntervall.setMinimum(1) 265 | self.spinBoxIntervall.setMaximum(3600) 266 | self.spinBoxIntervall.setProperty("value", 5) 267 | self.spinBoxIntervall.setObjectName("spinBoxIntervall") 268 | self.horizontalLayout.addWidget(self.spinBoxIntervall) 269 | self.buttonApply = QtWidgets.QPushButton(self.dockWidgetContents_6) 270 | self.buttonApply.setObjectName("buttonApply") 271 | self.horizontalLayout.addWidget(self.buttonApply) 272 | self.graphLayout.addLayout(self.horizontalLayout) 273 | self.gridLayout_7.addLayout(self.graphLayout, 0, 0, 1, 1) 274 | self.graphDockWidget.setWidget(self.dockWidgetContents_6) 275 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.graphDockWidget) 276 | self.actionConnect = QtWidgets.QAction(MainWindow) 277 | self.actionConnect.setObjectName("actionConnect") 278 | self.actionDisconnect = QtWidgets.QAction(MainWindow) 279 | self.actionDisconnect.setObjectName("actionDisconnect") 280 | self.actionSubscribeDataChange = QtWidgets.QAction(MainWindow) 281 | self.actionSubscribeDataChange.setObjectName("actionSubscribeDataChange") 282 | self.actionUnsubscribeDataChange = QtWidgets.QAction(MainWindow) 283 | self.actionUnsubscribeDataChange.setObjectName("actionUnsubscribeDataChange") 284 | self.actionSubscribeEvent = QtWidgets.QAction(MainWindow) 285 | self.actionSubscribeEvent.setObjectName("actionSubscribeEvent") 286 | self.actionUnsubscribeEvents = QtWidgets.QAction(MainWindow) 287 | self.actionUnsubscribeEvents.setObjectName("actionUnsubscribeEvents") 288 | self.actionCopyPath = QtWidgets.QAction(MainWindow) 289 | self.actionCopyPath.setObjectName("actionCopyPath") 290 | self.actionCopyNodeId = QtWidgets.QAction(MainWindow) 291 | self.actionCopyNodeId.setObjectName("actionCopyNodeId") 292 | self.actionAddToGraph = QtWidgets.QAction(MainWindow) 293 | self.actionAddToGraph.setObjectName("actionAddToGraph") 294 | self.actionRemoveFromGraph = QtWidgets.QAction(MainWindow) 295 | self.actionRemoveFromGraph.setObjectName("actionRemoveFromGraph") 296 | self.actionCall = QtWidgets.QAction(MainWindow) 297 | self.actionCall.setObjectName("actionCall") 298 | self.actionDark_Mode = QtWidgets.QAction(MainWindow) 299 | self.actionDark_Mode.setCheckable(True) 300 | self.actionDark_Mode.setObjectName("actionDark_Mode") 301 | self.actionClient_Application_Certificate = QtWidgets.QAction(MainWindow) 302 | self.actionClient_Application_Certificate.setObjectName("actionClient_Application_Certificate") 303 | self.actionFocusTree = QtWidgets.QAction(MainWindow) 304 | self.actionFocusTree.setObjectName("actionFocusTree") 305 | self.menuOPC_UA_Client.addAction(self.actionConnect) 306 | self.menuOPC_UA_Client.addAction(self.actionDisconnect) 307 | self.menuOPC_UA_Client.addAction(self.actionCopyPath) 308 | self.menuOPC_UA_Client.addAction(self.actionCopyNodeId) 309 | self.menuOPC_UA_Client.addAction(self.actionSubscribeDataChange) 310 | self.menuOPC_UA_Client.addAction(self.actionUnsubscribeDataChange) 311 | self.menuOPC_UA_Client.addAction(self.actionSubscribeEvent) 312 | self.menuOPC_UA_Client.addAction(self.actionUnsubscribeEvents) 313 | self.menuOPC_UA_Client.addAction(self.actionFocusTree) 314 | self.menuSettings.addAction(self.actionDark_Mode) 315 | self.menuSettings.addAction(self.actionClient_Application_Certificate) 316 | self.menuBar.addAction(self.menuOPC_UA_Client.menuAction()) 317 | self.menuBar.addAction(self.menuSettings.menuAction()) 318 | 319 | self.retranslateUi(MainWindow) 320 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 321 | MainWindow.setTabOrder(self.addrComboBox, self.connectOptionButton) 322 | MainWindow.setTabOrder(self.connectOptionButton, self.connectButton) 323 | MainWindow.setTabOrder(self.connectButton, self.disconnectButton) 324 | MainWindow.setTabOrder(self.disconnectButton, self.treeView) 325 | MainWindow.setTabOrder(self.treeView, self.attrView) 326 | MainWindow.setTabOrder(self.attrView, self.attrRefreshButton) 327 | MainWindow.setTabOrder(self.attrRefreshButton, self.subView) 328 | MainWindow.setTabOrder(self.subView, self.refView) 329 | MainWindow.setTabOrder(self.refView, self.evView) 330 | MainWindow.setTabOrder(self.evView, self.spinBoxNumberOfPoints) 331 | MainWindow.setTabOrder(self.spinBoxNumberOfPoints, self.spinBoxIntervall) 332 | MainWindow.setTabOrder(self.spinBoxIntervall, self.buttonApply) 333 | MainWindow.setTabOrder(self.buttonApply, self.logTextEdit) 334 | 335 | def retranslateUi(self, MainWindow): 336 | _translate = QtCore.QCoreApplication.translate 337 | MainWindow.setWindowTitle(_translate("MainWindow", "FreeOpcUa Client")) 338 | self.menuOPC_UA_Client.setTitle(_translate("MainWindow", "Act&ions")) 339 | self.menuSettings.setTitle(_translate("MainWindow", "Settings")) 340 | self.attrDockWidget.setWindowTitle(_translate("MainWindow", "&Attributes")) 341 | self.attrRefreshButton.setText(_translate("MainWindow", "Refresh")) 342 | self.connectButton.setText(_translate("MainWindow", "Connect")) 343 | self.disconnectButton.setText(_translate("MainWindow", "Disconnect")) 344 | self.connectOptionButton.setText(_translate("MainWindow", "Connect options")) 345 | self.subDockWidget.setWindowTitle(_translate("MainWindow", "S&ubscriptions")) 346 | self.refDockWidget.setWindowTitle(_translate("MainWindow", "&References")) 347 | self.evDockWidget.setWindowTitle(_translate("MainWindow", "&Events")) 348 | self.graphDockWidget.setWindowTitle(_translate("MainWindow", "&Graph")) 349 | self.labelNumberOfPoints.setText(_translate("MainWindow", "Number of Points")) 350 | self.labelIntervall.setText(_translate("MainWindow", "Intervall [s]")) 351 | self.buttonApply.setText(_translate("MainWindow", "Apply")) 352 | self.actionConnect.setText(_translate("MainWindow", "&Connect")) 353 | self.actionDisconnect.setText(_translate("MainWindow", "&Disconnect")) 354 | self.actionDisconnect.setToolTip(_translate("MainWindow", "Disconnect from server")) 355 | self.actionSubscribeDataChange.setText(_translate("MainWindow", "&Subscribe to data change")) 356 | self.actionSubscribeDataChange.setToolTip(_translate("MainWindow", "Subscribe to data change from selected node")) 357 | self.actionUnsubscribeDataChange.setText(_translate("MainWindow", "&Unsubscribe to DataChange")) 358 | self.actionUnsubscribeDataChange.setToolTip(_translate("MainWindow", "Unsubscribe to DataChange for current node")) 359 | self.actionSubscribeEvent.setText(_translate("MainWindow", "Subscribe to &events")) 360 | self.actionSubscribeEvent.setToolTip(_translate("MainWindow", "Subscribe to events from selected node")) 361 | self.actionUnsubscribeEvents.setText(_translate("MainWindow", "U&nsubscribe to Events")) 362 | self.actionUnsubscribeEvents.setToolTip(_translate("MainWindow", "Unsubscribe to Events from current node")) 363 | self.actionCopyPath.setText(_translate("MainWindow", "Copy &Path")) 364 | self.actionCopyPath.setToolTip(_translate("MainWindow", "Copy path to node to clipboard")) 365 | self.actionCopyNodeId.setText(_translate("MainWindow", "C&opy NodeId")) 366 | self.actionCopyNodeId.setToolTip(_translate("MainWindow", "Copy NodeId to clipboard")) 367 | self.actionAddToGraph.setText(_translate("MainWindow", "Add to &Graph")) 368 | self.actionAddToGraph.setToolTip(_translate("MainWindow", "Add this node to the graph")) 369 | self.actionAddToGraph.setShortcut(_translate("MainWindow", "Ctrl+G")) 370 | self.actionRemoveFromGraph.setText(_translate("MainWindow", "Remove from Graph")) 371 | self.actionRemoveFromGraph.setToolTip(_translate("MainWindow", "Remove this node from the graph")) 372 | self.actionRemoveFromGraph.setShortcut(_translate("MainWindow", "Ctrl+Shift+G")) 373 | self.actionCall.setText(_translate("MainWindow", "Call")) 374 | self.actionCall.setToolTip(_translate("MainWindow", "Call Ua Method")) 375 | self.actionDark_Mode.setText(_translate("MainWindow", "Dark Mode")) 376 | self.actionDark_Mode.setStatusTip(_translate("MainWindow", "Enables Dark Mode Theme")) 377 | self.actionClient_Application_Certificate.setText(_translate("MainWindow", "Client Application Certificate")) 378 | self.actionFocusTree.setText(_translate("MainWindow", "FocusTree")) 379 | self.actionFocusTree.setShortcut(_translate("MainWindow", "Alt+T")) 380 | -------------------------------------------------------------------------------- /uaclient/mainwindow_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 922 10 | 879 11 | 12 | 13 | 14 | FreeOpcUa Client 15 | 16 | 17 | 18 | ../network.svg../network.svg 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 0 28 | 29 | 30 | 31 | Qt::Horizontal 32 | 33 | 34 | 35 | 36 | 0 37 | 0 38 | 39 | 40 | 41 | Qt::StrongFocus 42 | 43 | 44 | Qt::ActionsContextMenu 45 | 46 | 47 | QAbstractItemView::NoEditTriggers 48 | 49 | 50 | true 51 | 52 | 53 | QAbstractItemView::DragOnly 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 0 64 | 0 65 | 922 66 | 24 67 | 68 | 69 | 70 | 71 | Act&ions 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Settings 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 0 97 | 0 98 | 99 | 100 | 101 | 102 | 400 103 | 170 104 | 105 | 106 | 107 | &Attributes 108 | 109 | 110 | 2 111 | 112 | 113 | 114 | 115 | 0 116 | 0 117 | 118 | 119 | 120 | 121 | 100 122 | 0 123 | 124 | 125 | 126 | 127 | 128 | 129 | Qt::StrongFocus 130 | 131 | 132 | QAbstractScrollArea::AdjustToContents 133 | 134 | 135 | QAbstractItemView::AllEditTriggers 136 | 137 | 138 | false 139 | 140 | 141 | Qt::ElideNone 142 | 143 | 144 | -1 145 | 146 | 147 | 18 148 | 149 | 150 | true 151 | 152 | 153 | true 154 | 155 | 156 | 157 | 158 | 159 | 160 | Qt::Horizontal 161 | 162 | 163 | 164 | 40 165 | 20 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | Refresh 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 0 184 | 0 185 | 186 | 187 | 188 | QDockWidget::NoDockWidgetFeatures 189 | 190 | 191 | Qt::TopDockWidgetArea 192 | 193 | 194 | 4 195 | 196 | 197 | 198 | 199 | 0 200 | 0 201 | 202 | 203 | 204 | 205 | 206 | 207 | Qt::StrongFocus 208 | 209 | 210 | Connect 211 | 212 | 213 | 214 | 215 | 216 | 217 | Qt::StrongFocus 218 | 219 | 220 | Disconnect 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 0 229 | 0 230 | 231 | 232 | 233 | true 234 | 235 | 236 | QComboBox::InsertAtTop 237 | 238 | 239 | 240 | 241 | 242 | 243 | Qt::StrongFocus 244 | 245 | 246 | Connect options 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 0 257 | 0 258 | 259 | 260 | 261 | S&ubscriptions 262 | 263 | 264 | 2 265 | 266 | 267 | 268 | 269 | 0 270 | 0 271 | 272 | 273 | 274 | 275 | 276 | 277 | Qt::StrongFocus 278 | 279 | 280 | true 281 | 282 | 283 | QAbstractScrollArea::AdjustToContents 284 | 285 | 286 | QAbstractItemView::NoEditTriggers 287 | 288 | 289 | false 290 | 291 | 292 | false 293 | 294 | 295 | QAbstractItemView::DropOnly 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 0 306 | 0 307 | 308 | 309 | 310 | &References 311 | 312 | 313 | 2 314 | 315 | 316 | 317 | 318 | 0 319 | 0 320 | 321 | 322 | 323 | 324 | 325 | 326 | Qt::StrongFocus 327 | 328 | 329 | QAbstractItemView::NoEditTriggers 330 | 331 | 332 | false 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 0 343 | 0 344 | 345 | 346 | 347 | &Events 348 | 349 | 350 | 2 351 | 352 | 353 | 354 | 355 | 356 | 357 | Qt::StrongFocus 358 | 359 | 360 | true 361 | 362 | 363 | QAbstractItemView::NoEditTriggers 364 | 365 | 366 | QAbstractItemView::DropOnly 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 8 376 | 377 | 378 | 379 | 380 | 381 | 382 | Qt::StrongFocus 383 | 384 | 385 | true 386 | 387 | 388 | false 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | &Graph 398 | 399 | 400 | 2 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | Number of Points 412 | 413 | 414 | 415 | 416 | 417 | 418 | 10 419 | 420 | 421 | 100 422 | 423 | 424 | 30 425 | 426 | 427 | 428 | 429 | 430 | 431 | Intervall [s] 432 | 433 | 434 | 435 | 436 | 437 | 438 | 1 439 | 440 | 441 | 3600 442 | 443 | 444 | 5 445 | 446 | 447 | 448 | 449 | 450 | 451 | Apply 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | &Connect 465 | 466 | 467 | 468 | 469 | &Disconnect 470 | 471 | 472 | Disconnect from server 473 | 474 | 475 | 476 | 477 | &Subscribe to data change 478 | 479 | 480 | Subscribe to data change from selected node 481 | 482 | 483 | 484 | 485 | &Unsubscribe to DataChange 486 | 487 | 488 | Unsubscribe to DataChange for current node 489 | 490 | 491 | 492 | 493 | Subscribe to &events 494 | 495 | 496 | Subscribe to events from selected node 497 | 498 | 499 | 500 | 501 | U&nsubscribe to Events 502 | 503 | 504 | Unsubscribe to Events from current node 505 | 506 | 507 | 508 | 509 | Copy &Path 510 | 511 | 512 | Copy path to node to clipboard 513 | 514 | 515 | 516 | 517 | C&opy NodeId 518 | 519 | 520 | Copy NodeId to clipboard 521 | 522 | 523 | 524 | 525 | Add to &Graph 526 | 527 | 528 | Add this node to the graph 529 | 530 | 531 | Ctrl+G 532 | 533 | 534 | 535 | 536 | Remove from Graph 537 | 538 | 539 | Remove this node from the graph 540 | 541 | 542 | Ctrl+Shift+G 543 | 544 | 545 | 546 | 547 | Call 548 | 549 | 550 | Call Ua Method 551 | 552 | 553 | 554 | 555 | true 556 | 557 | 558 | Dark Mode 559 | 560 | 561 | Enables Dark Mode Theme 562 | 563 | 564 | 565 | 566 | Client Application Certificate 567 | 568 | 569 | 570 | 571 | 572 | addrComboBox 573 | connectOptionButton 574 | connectButton 575 | disconnectButton 576 | treeView 577 | attrView 578 | attrRefreshButton 579 | subView 580 | refView 581 | evView 582 | spinBoxNumberOfPoints 583 | spinBoxIntervall 584 | buttonApply 585 | logTextEdit 586 | 587 | 588 | 589 | 590 | -------------------------------------------------------------------------------- /uaclient/theme/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/opcua-client-gui/240238d987b5030e175d8a987a6b4255d61146e0/uaclient/theme/__init__.py -------------------------------------------------------------------------------- /uaclient/theme/breeze.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | light/hmovetoolbar.svg 4 | light/vmovetoolbar.svg 5 | light/hsepartoolbar.svg 6 | light/vsepartoolbars.svg 7 | light/stylesheet-branch-end.svg 8 | light/stylesheet-branch-end-closed.svg 9 | light/stylesheet-branch-end-open.svg 10 | light/stylesheet-vline.svg 11 | light/stylesheet-branch-more.svg 12 | light/branch_closed.svg 13 | light/branch_closed-on.svg 14 | light/branch_open.svg 15 | light/branch_open-on.svg 16 | light/down_arrow.svg 17 | light/down_arrow_disabled.svg 18 | light/down_arrow-hover.svg 19 | light/left_arrow.svg 20 | light/left_arrow_disabled.svg 21 | light/right_arrow.svg 22 | light/right_arrow_disabled.svg 23 | light/up_arrow.svg 24 | light/up_arrow_disabled.svg 25 | light/up_arrow-hover.svg 26 | light/sizegrip.svg 27 | light/transparent.svg 28 | light/close.svg 29 | light/close-hover.svg 30 | light/close-pressed.svg 31 | light/undock.svg 32 | light/undock-hover.svg 33 | light/checkbox_checked-hover.svg 34 | light/checkbox_checked.svg 35 | light/checkbox_checked_disabled.svg 36 | light/checkbox_indeterminate.svg 37 | light/checkbox_indeterminate-hover.svg 38 | light/checkbox_indeterminate_disabled.svg 39 | light/checkbox_unchecked-hover.svg 40 | light/checkbox_unchecked_disabled.svg 41 | light/radio_checked-hover.svg 42 | light/radio_checked.svg 43 | light/radio_checked_disabled.svg 44 | light/radio_unchecked-hover.svg 45 | light/radio_unchecked_disabled.svg 46 | dark/hmovetoolbar.svg 47 | dark/vmovetoolbar.svg 48 | dark/hsepartoolbar.svg 49 | dark/vsepartoolbars.svg 50 | dark/stylesheet-branch-end.svg 51 | dark/stylesheet-branch-end-closed.svg 52 | dark/stylesheet-branch-end-open.svg 53 | dark/stylesheet-vline.svg 54 | dark/stylesheet-branch-more.svg 55 | dark/branch_closed.svg 56 | dark/branch_closed-on.svg 57 | dark/branch_open.svg 58 | dark/branch_open-on.svg 59 | dark/down_arrow.svg 60 | dark/down_arrow_disabled.svg 61 | dark/down_arrow-hover.svg 62 | dark/left_arrow.svg 63 | dark/left_arrow_disabled.svg 64 | dark/right_arrow.svg 65 | dark/right_arrow_disabled.svg 66 | dark/up_arrow.svg 67 | dark/up_arrow_disabled.svg 68 | dark/up_arrow-hover.svg 69 | dark/sizegrip.svg 70 | dark/transparent.svg 71 | dark/close.svg 72 | dark/close-hover.svg 73 | dark/close-pressed.svg 74 | dark/undock.svg 75 | dark/undock-hover.svg 76 | dark/checkbox_checked.svg 77 | dark/checkbox_checked_disabled.svg 78 | dark/checkbox_indeterminate.svg 79 | dark/checkbox_indeterminate_disabled.svg 80 | dark/checkbox_unchecked.svg 81 | dark/checkbox_unchecked_disabled.svg 82 | dark/radio_checked.svg 83 | dark/radio_checked_disabled.svg 84 | dark/radio_unchecked.svg 85 | dark/radio_unchecked_disabled.svg 86 | light.qss 87 | dark.qss 88 | 89 | 90 | -------------------------------------------------------------------------------- /uaclient/theme/dark/branch_closed-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/branch_closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/branch_open-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/branch_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_indeterminate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_indeterminate_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_unchecked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/checkbox_unchecked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/close-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/close-pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/down_arrow-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/down_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/hmovetoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/hsepartoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/left_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/left_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/radio_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/dark/radio_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/dark/radio_unchecked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/radio_unchecked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/right_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/right_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/sizegrip.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/spinup_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/stylesheet-branch-end-closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/stylesheet-branch-end-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/stylesheet-branch-end.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/stylesheet-branch-more.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/dark/stylesheet-vline.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/transparent.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /uaclient/theme/dark/undock-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/dark/undock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/up_arrow-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/up_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/dark/vmovetoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /uaclient/theme/dark/vsepartoolbars.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/light/branch_closed-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/branch_closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/branch_open-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/branch_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_checked-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_indeterminate-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_indeterminate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_indeterminate_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_unchecked-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/checkbox_unchecked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/close-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/close-pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/down_arrow-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/down_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/hmovetoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/hsepartoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/left_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/left_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/radio_checked-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/radio_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/radio_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/radio_unchecked-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/radio_unchecked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/right_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/right_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/sizegrip.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/spinup_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/stylesheet-branch-end-closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/stylesheet-branch-end-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/stylesheet-branch-end.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/stylesheet-branch-more.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /uaclient/theme/light/stylesheet-vline.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/transparent.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /uaclient/theme/light/undock-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uaclient/theme/light/undock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/up_arrow-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/up_arrow_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uaclient/theme/light/vmovetoolbar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /uaclient/theme/light/vsepartoolbars.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /uaclient/uaclient.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from PyQt5.QtCore import QSettings 4 | 5 | from asyncua import ua 6 | from asyncua.sync import Client, SyncNode 7 | from asyncua import crypto 8 | from asyncua.tools import endpoint_to_strings 9 | 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | 14 | class UaClient(object): 15 | """ 16 | OPC-Ua client specialized for the need of GUI client 17 | return exactly what GUI needs, no customization possible 18 | """ 19 | 20 | def __init__(self): 21 | self.settings = QSettings() 22 | self.application_uri = "urn:freeopcua:client-gui" 23 | self.client = None 24 | self._connected = False 25 | self._datachange_sub = None 26 | self._event_sub = None 27 | self._subs_dc = {} 28 | self._subs_ev = {} 29 | self.security_mode = None 30 | self.security_policy = None 31 | self.user_certificate_path = None 32 | self.user_private_key_path = None 33 | self.application_certificate_path = None 34 | self.application_private_key_path = None 35 | self.load_application_certificate_settings() 36 | 37 | def _reset(self): 38 | self.client = None 39 | self._connected = False 40 | self._datachange_sub = None 41 | self._event_sub = None 42 | self._subs_dc = {} 43 | self._subs_ev = {} 44 | 45 | @staticmethod 46 | def get_endpoints(uri): 47 | client = Client(uri, timeout=2) 48 | edps = client.connect_and_get_server_endpoints() 49 | for i, ep in enumerate(edps, start=1): 50 | logger.info('Endpoint %s:', i) 51 | for (n, v) in endpoint_to_strings(ep): 52 | logger.info(' %s: %s', n, v) 53 | logger.info('') 54 | return edps 55 | 56 | def load_security_settings(self, uri): 57 | self.security_mode = None 58 | self.security_policy = None 59 | self.user_certificate_path = None 60 | self.user_private_key_path = None 61 | 62 | mysettings = self.settings.value("security_settings", None) 63 | if mysettings is None: 64 | return 65 | if uri in mysettings: 66 | mode, policy, cert, key = mysettings[uri] 67 | self.security_mode = mode 68 | self.security_policy = policy 69 | self.user_certificate_path = cert 70 | self.user_private_key_path = key 71 | 72 | def save_security_settings(self, uri): 73 | mysettings = self.settings.value("security_settings", None) 74 | if mysettings is None: 75 | mysettings = {} 76 | mysettings[uri] = [self.security_mode, 77 | self.security_policy, 78 | self.user_certificate_path, 79 | self.user_private_key_path] 80 | self.settings.setValue("security_settings", mysettings) 81 | 82 | def load_application_certificate_settings(self): 83 | self.application_certificate_path = None 84 | self.application_private_key_path = None 85 | 86 | mysettings = self.settings.value("application_certificate_settings", None) 87 | if mysettings is None: 88 | return 89 | self.application_certificate_path = mysettings["application_certificate"] 90 | self.application_private_key_path = mysettings["application_private_key"] 91 | 92 | def save_application_certificate_settings(self): 93 | mysettings = self.settings.value("application_certificate_settings", None) 94 | if mysettings is None: 95 | mysettings = {} 96 | mysettings["application_certificate"] = self.application_certificate_path 97 | mysettings["application_private_key"] = self.application_private_key_path 98 | self.settings.setValue("application_certificate_settings", mysettings) 99 | 100 | def get_node(self, nodeid): 101 | return self.client.get_node(nodeid) 102 | 103 | def connect(self, uri): 104 | self.disconnect() 105 | logger.info("Connecting to %s with parameters %s, %s, %s, %s", uri, self.security_mode, self.security_policy, self.user_certificate_path, self.user_private_key_path) 106 | self.client = Client(uri) 107 | self.client.application_uri = self.application_uri 108 | self.client.description = "FreeOpcUa Client GUI" 109 | 110 | # Set user identity token 111 | if self.user_private_key_path: 112 | self.client.load_private_key(self.user_private_key_path) 113 | if self.user_certificate_path: 114 | self.client.load_client_certificate(self.user_certificate_path) 115 | 116 | # Set security mode and security policy 117 | if self.security_mode is not None and self.security_policy is not None: 118 | self.client.set_security( 119 | getattr(crypto.security_policies, 'SecurityPolicy' + self.security_policy), 120 | self.application_certificate_path, 121 | self.application_private_key_path, 122 | mode=getattr(ua.MessageSecurityMode, self.security_mode) 123 | ) 124 | self.client.connect() 125 | self._connected = True 126 | self.client.load_data_type_definitions() 127 | try: 128 | self.client.load_enums() 129 | self.client.load_type_definitions() 130 | except Exception: 131 | logger.exception("Loading custom stuff with spec <= 1.03 did not work") 132 | self.save_security_settings(uri) 133 | 134 | def disconnect(self): 135 | if self._connected: 136 | print("Disconnecting from server") 137 | self._connected = False 138 | try: 139 | self.client.disconnect() 140 | finally: 141 | self._reset() 142 | 143 | def subscribe_datachange(self, node, handler): 144 | if not self._datachange_sub: 145 | self._datachange_sub = self.client.create_subscription(500, handler) 146 | handle = self._datachange_sub.subscribe_data_change(node) 147 | self._subs_dc[node.nodeid] = handle 148 | return handle 149 | 150 | def unsubscribe_datachange(self, node): 151 | self._datachange_sub.unsubscribe(self._subs_dc[node.nodeid]) 152 | 153 | def subscribe_events(self, node, handler): 154 | if not self._event_sub: 155 | print("subscirbing with handler: ", handler, dir(handler)) 156 | self._event_sub = self.client.create_subscription(500, handler) 157 | handle = self._event_sub.subscribe_events(node) 158 | self._subs_ev[node.nodeid] = handle 159 | return handle 160 | 161 | def unsubscribe_events(self, node): 162 | self._event_sub.unsubscribe(self._subs_ev[node.nodeid]) 163 | 164 | def get_node_attrs(self, node): 165 | if not isinstance(node, SyncNode): 166 | node = self.client.get_node(node) 167 | attrs = node.read_attributes([ua.AttributeIds.DisplayName, ua.AttributeIds.BrowseName, ua.AttributeIds.NodeId]) 168 | return node, [attr.Value.Value.to_string() for attr in attrs] 169 | 170 | @staticmethod 171 | def get_children(node): 172 | descs = node.get_children_descriptions() 173 | descs.sort(key=lambda x: x.BrowseName) 174 | return descs 175 | --------------------------------------------------------------------------------