• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jjgomera / pychemqt / 9884aeeb-db0a-40bd-9404-6d7422e6d7b0

29 Jul 2025 01:51PM UTC coverage: 72.181% (-0.02%) from 72.199%
9884aeeb-db0a-40bd-9404-6d7422e6d7b0

push

circleci

jjgomera
Merge branch 'master' of https://github.com/jjgomera/pychemqt

30 of 130 new or added lines in 15 files covered. (23.08%)

702 existing lines in 22 files now uncovered.

28858 of 39980 relevant lines covered (72.18%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

34.62
/lib/thread.py
1
#!/usr/bin/python3
2
# -*- coding: utf-8 -*-
3

4
'''Pychemqt, Chemical Engineering Process simulator
5
Copyright (C) 2009-2025, Juan José Gómez Romera <jjgomera@gmail.com>
6

7
This program is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11

12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16

17
You should have received a copy of the GNU General Public License
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
19

20

21
Library for work with thread in pychemqt for improve UI response
22
  * :class:`WaitforClick`: Thread for draw stream in PFD
23
  * :class:`Evaluate`: Thread to insolate entity calculation from gui, used \
24
            in streams equipment, and project
25

26
API reference
27
-------------
28

29
'''
30

31

32
from time import sleep
1✔
33

34
from tools.qt import QtCore
1✔
35

36

37
class WaitforClick(QtCore.QThread):
1✔
38
    """
39
    Thread used in PFD drawing to specified stream input and output or add
40
    equipment.
41
    TODO: Use to customize stream drawing
42
    """
43
    def __init__(self, num, parent=None):
1✔
UNCOV
44
        super().__init__(parent)
×
UNCOV
45
        self.setTerminationEnabled(True)
×
46
        self.num = num
×
47

48
    def run(self):
1✔
49
        """Wait until the mouse is clicked"""
UNCOV
50
        while True:
×
UNCOV
51
            sleep(0.1)
×
UNCOV
52
            if len(self.parent().Pos) >= self.num:
×
UNCOV
53
                break
×
54

55

56
class Evaluate(QtCore.QThread):
1✔
57
    """
58
    Thread used to insolate calculation process in entities (stream, project
59
    and equipment, so gui can response while calculation is in process
60
    """
61
    def __init__(self, parent=None):
1✔
UNCOV
62
        super().__init__(parent)
×
UNCOV
63
        self.mutex = QtCore.QMutex()
×
UNCOV
64
        self.entity = None
×
65
        self.kwargs = None
×
66

67
    def start(self, entity, kwargs):
1✔
68
        """Rewrite QThread start procedure"""
UNCOV
69
        self.entity = entity
×
UNCOV
70
        self.kwargs = kwargs
×
71
        QtCore.QThread.start(self)
×
72

73
    def run(self):
1✔
74
        """Evaluate entity"""
UNCOV
75
        self.mutex.lock()
×
UNCOV
76
        self.entity(**self.kwargs)
×
UNCOV
77
        self.mutex.unlock()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc