-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasy_keymap_generator.py
49 lines (35 loc) · 1.08 KB
/
easy_keymap_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import bpy
import csv
import sys
from PySide2.QtCore import QEventLoop
from PySide2.QtWidgets import *
from . import ui
class PYSIDE_OT_display_window(bpy.types.Operator):
bl_idname = 'pyside.display_window'
bl_label = "Display Window"
bl_options = {'REGISTER'}
def execute(self, context): # eventloop should be here
self.app = QApplication.instance()
if not self.app:
self.app = QApplication(sys.argv)
self.event_loop = QEventLoop()
self.widget = ui.EasyKeymapMainWindow()
self.widget.show()
# self.app.exec_() DON'T exec app
return {'FINISHED'}
class PYSIDE_PT_tools_my_panel(bpy.types.Panel):
bl_label = "Test Pyside"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
def draw(self, context):
layout = self.layout
layout.operator('pyside.display_window')
classs = [
PYSIDE_OT_display_window, PYSIDE_PT_tools_my_panel
]
def register():
for c in classs:
bpy.utils.register_class(c)
def unregister():
for c in classs:
bpy.utils.unregister_class(c)