Skip to content

Commit

Permalink
Issue #72: Node [Panel] Redesign: continued...
Browse files Browse the repository at this point in the history
  • Loading branch information
kateliev committed Dec 7, 2022
1 parent 47ddbd5 commit 8b43b82
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 25 deletions.
Binary file modified Lib/typerig/proxy/fl/gui/resource/typerig-icons.ttf
Binary file not shown.
18 changes: 17 additions & 1 deletion Lib/typerig/proxy/fl/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from typerig.proxy.fl.objects.glyph import eGlyph

# - Init ----------------------------------
__version__ = '0.3.6'
__version__ = '0.3.7'

# - Keep compatibility for basestring checks
try:
Expand Down Expand Up @@ -141,6 +141,22 @@ def FLIconButton(button_text, icon_path, icon_size=32, checkable=False):
return new_button

# -- Miniwidgets --------------------------
class CustomDoubleSpinBox(QtGui.QDoubleSpinBox):
def __init__(self, init_values=(0., 100., 0., 1.), tooltip=None, obj_name=None):
super(CustomDoubleSpinBox, self).__init__()

# - Init
spb_min, spb_max, spb_value, spb_step = init_values

# - Set
self.setMinimum(spb_min)
self.setMaximum(spb_max)
self.setValue(spb_value)
self.setSingleStep(spb_step)

if tooltip is not None: self.setToolTip(tooltip)
if obj_name is not None: self.setObjectName(obj_name)

class CustomSpinButton(QtGui.QWidget):
def __init__(self, button_text, init_values=(0., 100., 0., 1.), tooltip=(None, None), obj_name=(None, None)):
super(CustomSpinButton, self).__init__()
Expand Down
115 changes: 91 additions & 24 deletions Scripts/TypeRig GUI/Panel/NNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from typerig.proxy.fl.actions.node import TRNodeActionCollector
from typerig.proxy.fl.application.app import pWorkspace
#from typerig.proxy.fl.gui import QtGui
from typerig.proxy.fl.gui.widgets import getTRIconFontPath, CustomPushButton, CustomSpinButton
from typerig.proxy.fl.gui.widgets import getTRIconFontPath, CustomLabel, CustomPushButton, CustomSpinButton, CustomDoubleSpinBox
from typerig.proxy.fl.gui.styles import css_tr_button

# - Init -------------------------------
Expand Down Expand Up @@ -54,7 +54,7 @@
}
QPushButton#btn_panel_opt,
QPushButton#btn_panel {
QPushButton#btn_panel, QLabel#lbl_panel {
color: #212121;
font-family: "TypeRig Icons";
font-size: 20px;
Expand Down Expand Up @@ -366,41 +366,41 @@ def __init__(self):
lay_slope.setContentsMargins(0, 0, 0, 0)

# --- Options
tooltip = "Copy slope between selected nodes"
tooltip_button = "Copy slope between selected nodes"
self.chk_slope_copy = CustomPushButton("slope_copy", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_slope_options.addButton(self.chk_slope_copy)
lay_slope.addWidget(self.chk_slope_copy, 0, 0)
self.chk_slope_copy.clicked.connect(self.act_slope_copy)

tooltip = "Use fonts italic angle as slope"
tooltip_button = "Use fonts italic angle as slope"
self.chk_slope_italic = CustomPushButton("slope_italic", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_slope_options.addButton(self.chk_slope_italic)
lay_slope.addWidget(self.chk_slope_italic, 0, 1)
self.chk_slope_italic.clicked.connect(self.act_slope_italic)

# - Actions
tooltip = "Paste slope to selected nodes pivoting around the one with lowest vertical coordinates"
tooltip_button = "Paste slope to selected nodes pivoting around the one with lowest vertical coordinates"
self.btn_slope_paste_min = CustomPushButton("slope_paste_min", tooltip=tooltip_button, obj_name='btn_panel')
self.grp_slope_options.addButton(self.btn_slope_paste_min)
lay_slope.addWidget(self.btn_slope_paste_min, 1, 0)
lay_slope.addWidget(self.btn_slope_paste_min, 0, 2)
self.btn_slope_paste_min.clicked.connect(lambda: TRNodeActionCollector.slope_paste(pMode, pLayers, self.slope_bank, (False, False)))

tooltip = "Paste slope to selected nodes pivoting around the one with highest vertical coordinates"
tooltip_button = "Paste slope to selected nodes pivoting around the one with highest vertical coordinates"
self.btn_slope_paste_max = CustomPushButton("slope_paste_max", tooltip=tooltip_button, obj_name='btn_panel')
self.grp_slope_options.addButton(self.btn_slope_paste_max)
lay_slope.addWidget(self.btn_slope_paste_max, 1, 1)
lay_slope.addWidget(self.btn_slope_paste_max, 0, 3)
self.btn_slope_paste_max.clicked.connect(lambda: TRNodeActionCollector.slope_paste(pMode, pLayers, self.slope_bank, (True, False)))

tooltip = "Paste horizontally flipped slope to selected nodes pivoting around the one with lowest vertical coordinates"
tooltip_button = "Paste horizontally flipped slope to selected nodes pivoting around the one with lowest vertical coordinates"
self.btn_slope_paste_min_flip = CustomPushButton("slope_paste_min_flip", tooltip=tooltip_button, obj_name='btn_panel')
self.grp_slope_options.addButton(self.btn_slope_paste_min_flip)
lay_slope.addWidget(self.btn_slope_paste_min_flip, 1, 2)
lay_slope.addWidget(self.btn_slope_paste_min_flip, 0, 4)
self.btn_slope_paste_min_flip.clicked.connect(lambda: TRNodeActionCollector.slope_paste(pMode, pLayers, self.slope_bank, (False, True)))

tooltip = "Paste horizontally flipped slope to selected nodes pivoting around the one with highest vertical coordinates"
tooltip_button = "Paste horizontally flipped slope to selected nodes pivoting around the one with highest vertical coordinates"
self.btn_slope_paste_max_flip = CustomPushButton("slope_paste_max_flip", tooltip=tooltip_button, obj_name='btn_panel')
self.grp_slope_options.addButton(self.btn_slope_paste_max_flip)
lay_slope.addWidget(self.btn_slope_paste_max_flip, 1, 3)
lay_slope.addWidget(self.btn_slope_paste_max_flip, 0, 5)
self.btn_slope_paste_max_flip.clicked.connect(lambda: TRNodeActionCollector.slope_paste(pMode, pLayers, self.slope_bank, (True, True)))

box_slope.setLayout(lay_slope)
Expand All @@ -416,64 +416,131 @@ def __init__(self):
lay_copy_nodes.setContentsMargins(0, 0, 0, 0)

# --- Options
tooltip = "Paste Align Top Left"
tooltip_button = "Paste Align Top Left"
self.chk_paste_top_left = CustomPushButton("node_align_top_left", checkable=True, cheked=True, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_copy_nodes_options.addButton(self.chk_paste_top_left)
lay_copy_nodes.addWidget(self.chk_paste_top_left, 0, 0)
#self.chk_paste_top_left.clicked.connect(...)

tooltip = "Paste: Align Top Right"
tooltip_button = "Paste: Align Top Right"
self.chk_paste_top_right = CustomPushButton("node_align_top_right", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_copy_nodes_options.addButton(self.chk_paste_top_right)
lay_copy_nodes.addWidget(self.chk_paste_top_right, 0, 1)
#self.chk_paste_top_right.clicked.connect(...)

tooltip = "Paste: Align Bottom Left"
tooltip_button = "Paste: Align Center"
self.chk_paste_center = CustomPushButton("node_center", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_copy_nodes_options.addButton(self.chk_paste_center)
lay_copy_nodes.addWidget(self.chk_paste_center, 0, 2)
#self.chk_paste_top_right.clicked.connect(...)

tooltip_button = "Paste: Align Bottom Left"
self.chk_paste_bottom_left = CustomPushButton("node_align_bottom_left", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_copy_nodes_options.addButton(self.chk_paste_bottom_left)
lay_copy_nodes.addWidget(self.chk_paste_bottom_left, 0, 3)
#self.chk_paste_bottom_left.clicked.connect(...)

tooltip = "Paste: Align Bottom Right"
tooltip_button = "Paste: Align Bottom Right"
self.chk_paste_bottom_right = CustomPushButton("node_align_bottom_right", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_copy_nodes_options.addButton(self.chk_paste_bottom_right)
lay_copy_nodes.addWidget(self.chk_paste_bottom_right, 0, 4)
#self.chk_paste_bottom_right.clicked.connect(...)


tooltip = "Paste: Flip horizontally"
tooltip_button = "Paste: Flip horizontally"
self.chk_paste_flip_h = CustomPushButton("flip_horizontal", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
#self.grp_paste_nodes_options.addButton(self.chk_paste_flip_h)
lay_copy_nodes.addWidget(self.chk_paste_flip_h, 1, 0)
#self.chk_paste_flip_h.clicked.connect(...)

tooltip = "Paste: Flip vertically"
tooltip_button = "Paste: Flip vertically"
self.chk_flip_v = CustomPushButton("flip_vertical", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
#self.grp_paste_nodes_options.addButton(self.chk_flip_v)
lay_copy_nodes.addWidget(self.chk_flip_v, 1, 1)
#self.chk_flip_v.clicked.connect(...)

tooltip = "Paste: Reverse Order"
tooltip_button = "Paste: Reverse Order"
self.chk_paste_reverse = CustomPushButton("contour_reverse", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
#self.grp_copy_nodes_options.addButton(self.chk_paste_reverse)
lay_copy_nodes.addWidget(self.chk_paste_reverse, 1, 2)
#self.chk_paste_reverse.clicked.connect(...)

tooltip = "Copy: Selected Nodes"
self.chk_copy_nodes = CustomPushButton("node_copy", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
tooltip_button = "Copy: Selected Nodes"
self.chk_copy_nodes = CustomPushButton("node_copy", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel')
#self.grp_copy_nodes_options.addButton(self.chk_copy_nodes)
lay_copy_nodes.addWidget(self.chk_copy_nodes, 1, 3)
#self.chk_copy_nodes.clicked.connect(...)

tooltip = "Paste: Nodes stored in Memory"
self.chk_copy_nodes = CustomPushButton("node_paste", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel')
tooltip_button = "Paste: Nodes stored in Memory"
self.chk_copy_nodes = CustomPushButton("node_paste", checkable=False, cheked=False, tooltip=tooltip_button, obj_name='btn_panel')
#self.grp_copy_nodes_options.addButton(self.chk_copy_nodes)
lay_copy_nodes.addWidget(self.chk_copy_nodes, 1, 4)
#self.chk_copy_nodes.clicked.connect(...)

box_copy_nodes.setLayout(lay_copy_nodes)
self.lay_main.addWidget(box_copy_nodes)

# -- Move Nodes ------------------------------------------------------
box_move_nodes = QtGui.QGroupBox()
box_move_nodes.setObjectName('box_group')

self.grp_move_nodes_options = QtGui.QButtonGroup()

lay_move_nodes = QtGui.QGridLayout()
lay_move_nodes.setContentsMargins(0, 0, 0, 0)

# --- Options
tooltip_button = "Smart Shift:\n Move off-curve nodes together with on-curve ones"
self.chk_shift_smart = CustomPushButton("shift_smart", checkable=True, cheked=True, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_move_nodes_options.addButton(self.chk_shift_smart)
lay_move_nodes.addWidget(self.chk_shift_smart, 0, 0)

tooltip_button = "Shift:\n Do not move off-curve nodes together with on-curve ones"
self.chk_shift_dumb = CustomPushButton("shift_dumb", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_move_nodes_options.addButton(self.chk_shift_dumb)
lay_move_nodes.addWidget(self.chk_shift_dumb, 0, 1)

tooltip_button = "Interpolated shift"
self.chk_shift_lerp = CustomPushButton("shift_interpolate", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_move_nodes_options.addButton(self.chk_shift_lerp)
lay_move_nodes.addWidget(self.chk_shift_lerp, 0, 2)
#self.chk_paste_top_left.clicked.connect(...)

tooltip_button = "Italic walker:\n Vertical shift along the font's italic angle"
self.chk_shift_italic = CustomPushButton("shift_slope_italik", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_move_nodes_options.addButton(self.chk_shift_italic)
lay_move_nodes.addWidget(self.chk_shift_italic, 0,3)
#self.chk_paste_top_left.clicked.connect(...)

tooltip_button = "Slope walker:\n Vertical shift along a given slope"
self.chk_shift_slope = CustomPushButton("shift_slope_walk", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
self.grp_move_nodes_options.addButton(self.chk_shift_slope)
lay_move_nodes.addWidget(self.chk_shift_slope, 0, 4)
#self.chk_paste_top_left.clicked.connect(...)

tooltip_button = "Copy slope between selected nodes"
self.chk_shift_italic = CustomPushButton("slope_copy", checkable=True, cheked=False, tooltip=tooltip_button, obj_name='btn_panel_opt')
#self.grp_move_nodes_options.addButton(self.chk_shift_italic)
lay_move_nodes.addWidget(self.chk_shift_italic, 0, 5)
#self.chk_paste_top_left.clicked.connect(...)

lbl_x = CustomLabel('X', obj_name='lbl_panel')
lay_move_nodes.addWidget(lbl_x, 1, 0)

self.spn_move_x = CustomDoubleSpinBox(init_values=(-999., 999., 0., 1.), tooltip='Horizontal shift value', obj_name='spn_panel')
lay_move_nodes.addWidget(self.spn_move_x, 1, 1)

lbl_y = CustomLabel('Y', obj_name='lbl_panel')
lay_move_nodes.addWidget(lbl_y, 1, 2)

self.spn_move_y = CustomDoubleSpinBox(init_values=(-999., 999., 0., 1.), tooltip='Horizontal shift value', obj_name='spn_panel')
lay_move_nodes.addWidget(self.spn_move_y, 1, 3)




box_move_nodes.setLayout(lay_move_nodes)
self.lay_main.addWidget(box_move_nodes)

# -- Finish it -------------------------------------------------------
self.setLayout(self.lay_main)

Expand Down

0 comments on commit 8b43b82

Please sign in to comment.