Skip to content

Commit 3b0b7be

Browse files
committed
remove pyqt5 dependenciy on Sift imports
1 parent 5aabc61 commit 3b0b7be

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

pyqttoolkit/data/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
from .interval import calculate_interval
1919
from .bits import get_next_available_bit
2020
from .names import get_next_available_name
21+
from .message import MessageType, MessageResponse

pyqttoolkit/data/message.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# pyqttoolkit
2+
# Copyright (C) 2018-2019, Simmovation Ltd.
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, write to the Free Software Foundation,
16+
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
from enum import Enum, IntEnum
18+
19+
class MessageType(Enum):
20+
validation_error = 0
21+
confirmation = 1
22+
application_exception = 2
23+
24+
class MessageResponse(IntEnum):
25+
ok = 1
26+
cancel = 2
27+
save = 4
28+
discard = 8
29+
ignore = 16

pyqttoolkit/exceptions/__init__.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# pyqttoolkit
2+
# Copyright (C) 2018-2019, Simmovation Ltd.
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, write to the Free Software Foundation,
16+
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
class TaskCancelled(Exception):
18+
pass

pyqttoolkit/services/message_board.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,13 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program; if not, write to the Free Software Foundation,
1616
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17-
from enum import Enum, IntEnum
1817

1918
#pylint: disable=no-name-in-module
2019
from PyQt5.QtCore import QObject, pyqtSignal, Qt
2120
#pylint: enable=no-name-in-module
2221

2322
from ..properties import AutoProperty
24-
25-
class MessageType(Enum):
26-
validation_error = 0
27-
confirmation = 1
28-
application_exception = 2
29-
30-
class MessageResponse(IntEnum):
31-
ok = 1
32-
cancel = 2
33-
save = 4
34-
discard = 8
35-
ignore = 16
23+
from ..data import MessageType, MessageResponse
3624

3725
class MessageArgs:
3826
def __init__(self, message_type, message, checkbox_message, response_type, text_format):

pyqttoolkit/services/task_runner.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from concurrent.futures import ThreadPoolExecutor
2727

2828
from ..properties import AutoProperty
29+
from ..exceptions import TaskCancelled
2930

3031
LOGGER = logging.getLogger(__name__)
3132

@@ -71,8 +72,6 @@ def cancel(self):
7172
if self._cancellable:
7273
self.cancelled.emit()
7374

74-
class TaskCancelled(Exception):
75-
pass
7675

7776
class Worker:
7877
def __init__(self, task_runner, f, args, busy_args, on_completed, on_cancelled, on_error, error_description):

0 commit comments

Comments
 (0)