Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
58d5bb4c
Commit
58d5bb4c
authored
Jun 26, 2023
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unique name generator function
parent
9bbf5467
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
util.py
blink/util.py
+12
-1
No files found.
blink/util.py
View file @
58d5bb4c
...
...
@@ -5,20 +5,31 @@ from application.python.decorator import decorator, preserve_signature
from
application.python.descriptor
import
classproperty
from
application.python.types
import
Singleton
from
functools
import
partial
from
itertools
import
count
from
threading
import
Event
from
sys
import
exc_info
from
blink.event
import
CallFunctionEvent
__all__
=
[
'QSingleton'
,
'call_in_gui_thread'
,
'call_later'
,
'run_in_gui_thread'
,
'translate'
]
__all__
=
[
'QSingleton'
,
'
UniqueFilenameGenerator'
,
'
call_in_gui_thread'
,
'call_later'
,
'run_in_gui_thread'
,
'translate'
]
translate
=
QCoreApplication
.
translate
class
QSingleton
(
Singleton
,
type
(
QObject
)):
"""A metaclass for making Qt objects singletons"""
class
UniqueFilenameGenerator
(
object
):
@
classmethod
def
generate
(
cls
,
name
):
yield
name
prefix
,
extension
=
os
.
path
.
splitext
(
name
)
for
x
in
count
(
1
):
yield
"
%
s-
%
d
%
s"
%
(
prefix
,
x
,
extension
)
def
call_later
(
interval
,
function
,
*
args
,
**
kw
):
QTimer
.
singleShot
(
int
(
interval
*
1000
),
lambda
:
function
(
*
args
,
**
kw
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment