Skip to content

Commit 4d85c79

Browse files
committed
[UI] Improved imagepack viewer's help text
1 parent 1efb70f commit 4d85c79

File tree

4 files changed

+360
-106
lines changed

4 files changed

+360
-106
lines changed

src/preppipe/commontypes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ def get_string(self) -> str:
9595
def __str__(self) -> str:
9696
return self.get_string()
9797

98+
def __eq__(self, value: Color) -> bool:
99+
if not isinstance(value, Color):
100+
return False
101+
return self.r == value.r and self.g == value.g and self.b == value.b and self.a == value.a
102+
103+
def __hash__(self) -> int:
104+
return hash((self.r, self.g, self.b, self.a))
105+
98106
@staticmethod
99107
def get(src: typing.Any):
100108
"""!

src/preppipe_gui_pyside6/componentwidgets/maskinputwidget.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ def __init__(self, parent=None):
172172
def getValue(self) -> Color | PIL.Image.Image | tuple[str, Color] | None:
173173
return self.current_value_converted
174174

175+
def getImageFilePath(self) -> str:
176+
assert self.current_type == "image"
177+
assert isinstance(self.current_value, str)
178+
return self.current_value
179+
175180
def setIsColorOnly(self, is_color_only: bool):
176181
self.is_color_only = is_color_only
177182

src/preppipe_gui_pyside6/forms/imagepackwidget.ui

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>887</width>
10-
<height>533</height>
9+
<width>881</width>
10+
<height>543</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -27,8 +27,8 @@
2727
</property>
2828
<widget class="QFrame" name="viewerFrame">
2929
<property name="sizePolicy">
30-
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
31-
<horstretch>0</horstretch>
30+
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
31+
<horstretch>4</horstretch>
3232
<verstretch>0</verstretch>
3333
</sizepolicy>
3434
</property>
@@ -55,7 +55,7 @@
5555
</widget>
5656
<widget class="QGroupBox" name="controlAreaGroupBox">
5757
<property name="sizePolicy">
58-
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
58+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
5959
<horstretch>0</horstretch>
6060
<verstretch>0</verstretch>
6161
</sizepolicy>
@@ -91,30 +91,29 @@
9191
</widget>
9292
</item>
9393
<item>
94-
<spacer name="verticalSpacer">
95-
<property name="orientation">
96-
<enum>Qt::Orientation::Vertical</enum>
97-
</property>
98-
<property name="sizeHint" stdset="0">
99-
<size>
100-
<width>20</width>
101-
<height>40</height>
102-
</size>
103-
</property>
104-
</spacer>
105-
</item>
106-
<item>
107-
<widget class="QLabel" name="infoLabel">
94+
<widget class="QTextEdit" name="infoTextEdit">
10895
<property name="sizePolicy">
109-
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
96+
<sizepolicy hsizetype="Ignored" vsizetype="MinimumExpanding">
11097
<horstretch>0</horstretch>
111-
<verstretch>0</verstretch>
98+
<verstretch>1</verstretch>
11299
</sizepolicy>
113100
</property>
114-
<property name="text">
115-
<string>说明信息</string>
101+
<property name="frameShape">
102+
<enum>QFrame::Shape::NoFrame</enum>
103+
</property>
104+
<property name="verticalScrollBarPolicy">
105+
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
106+
</property>
107+
<property name="horizontalScrollBarPolicy">
108+
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
109+
</property>
110+
<property name="sizeAdjustPolicy">
111+
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
112+
</property>
113+
<property name="undoRedoEnabled">
114+
<bool>false</bool>
116115
</property>
117-
<property name="wordWrap">
116+
<property name="readOnly">
118117
<bool>true</bool>
119118
</property>
120119
</widget>

0 commit comments

Comments
 (0)