Skip to content

Commit ec97e67

Browse files
committed
Focus inspector tab on rename
1 parent 97f2b89 commit ec97e67

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

editor/inspector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def __init__(self, parent, prop, orig):
112112

113113
def keyPressEvent(self, event):
114114
if event.key() == Qt.Key_Escape:
115+
# self.setText(str(self.value))
115116
self.clearFocus()
116117
super(InspectorTextEdit, self).keyPressEvent(event)
117118

editor/window.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
from PyQt5.QtCore import Qt
12
from PyQt5.QtWidgets import *
23
from PyQt5.QtGui import QIcon, QFont
34
import os
45
from .resources import *
5-
from .render import SceneEditor
66

77
class Window(QMainWindow):
88
def __init__(self, app):
99
super(Window, self).__init__()
1010
self.setWindowTitle("PyUnity Editor")
11+
self.setFocusPolicy(Qt.StrongFocus)
1112
self.app = app
1213
self.app.setFont(QFont("Segoe UI", 10))
1314
self.toolbar = ToolBar(self)
@@ -49,6 +50,7 @@ def select_none(self):
4950
self.app.hierarchy_content.tree_widget.clearSelection()
5051

5152
def rename(self):
53+
self.app.inspector.tab_widget.setCurrentWidget(self.app.inspector)
5254
box = list(self.app.inspector_content.sections[0].fields.keys())[0]
5355
box.setFocus()
5456
box.selectAll()
@@ -200,6 +202,7 @@ def add_tab(self, name, row):
200202
class TabGroup(QTabWidget):
201203
def __init__(self, parent):
202204
super(TabGroup, self).__init__(parent)
205+
self.setMovable(True)
203206
self.currentChanged.connect(self.tab_change)
204207

205208
def tab_change(self, index):

0 commit comments

Comments
 (0)