Skip to content

Commit

Permalink
Merge branch 'Development' of https://github.com/sideeffects/SideFXLabs
Browse files Browse the repository at this point in the history
… into Development
  • Loading branch information
baileycc committed Nov 27, 2024
2 parents 1ae454e + e0fc363 commit 2f732ad
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 10 deletions.
55 changes: 55 additions & 0 deletions scripts/python/edu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import hou
import importlib

from hutil.Qt.QtCore import *
from hutil.Qt.QtGui import *
from hutil.Qt.QtWidgets import *

import labutils

from past.utils import old_div
import nodegraphutils

Expand Down Expand Up @@ -91,6 +97,53 @@ def createNotes(kwargs, stickytype="info"):
sticky.setTextColor(hou.Color(normalize_color(COLOR_TXT[stickytype])))


# add a background image to the current network editor with the option to embbed it
def addBackgroundImage():
dialog = BackgroundImages(hou.qt.mainWindow())
dialog.show()

class BackgroundImages(QDialog):
def __init__(self, parent):
super(BackgroundImages, self).__init__(parent)
self.setWindowTitle("Add Background Image")
self.build_ui()

def build_ui(self):
self.cbx_embbed = QCheckBox("Embbed image")
self.btn_choose = QPushButton("Choose Image")
self.btn_cancel = QPushButton("Cancel")
self.btn_choose.clicked.connect(self.on_choosebtn_press)
self.btn_cancel.clicked.connect(self.on_cancelbtn_press)

button_layout = QHBoxLayout()
button_layout.addWidget(self.cbx_embbed)
button_layout.addWidget(self.btn_choose)
button_layout.addWidget(self.btn_cancel)

layout = QVBoxLayout()
layout.addLayout(button_layout)

self.setLayout(layout)

def on_choosebtn_press(self):
home_folder = os.path.expanduser("~")

for ptab in hou.ui.currentPaneTabs():
if ptab.type() == hou.paneTabType.NetworkEditor:
network_editor = ptab
fileName, selectedFilter = QFileDialog.getOpenFileName(self, str("Open Image"), home_folder, str("Image Files (*.png *.jpg *.bmp)"))
scale = 1
embedded = self.cbx_embbed.isChecked()
relativeto_path = None
bounds = None

labutils.add_network_image(network_editor, fileName, scale, embedded, relativeto_path=None, bounds=None)
self.close()

def on_cancelbtn_press(self):
self.close()


class Quickmarks(object):

def __init__(self):
Expand Down Expand Up @@ -239,3 +292,5 @@ def jumpTo(self, value):
nodegraphview.createUndoQuickMark(self._pane)
if quickmark is not None:
quickmark.jump(self._pane)


15 changes: 5 additions & 10 deletions scripts/python/sidefxedu.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,13 @@ def build_ui(self):
version_layout = QHBoxLayout()
update_version_label = QLabel("Release:")

self.version_combo = QComboBox(self)
for release in self.updater_object.production_releases[:10]:
self.version_combo.addItem(release)

self.production_builds_check = QCheckBox("Production Builds Only")
self.production_builds_check.setChecked(True)
self.production_builds_check.setChecked(False)
self.production_builds_check.stateChanged.connect(self.on_production_check)

self.version_combo = QComboBox(self)
self.on_production_check()

version_layout.addWidget(update_version_label)
version_layout.addWidget(self.version_combo)
version_layout.addWidget(self.production_builds_check)
Expand All @@ -177,11 +176,9 @@ def build_ui(self):
changedgroup_layout.addLayout(version_layout)
self.button = QPushButton("Update")
self.uninstallButton = QPushButton("Uninstall")
self.launcherButton = QPushButton("Start Launcher")

self.button.clicked.connect(self.on_updatebtn_press)
self.uninstallButton.clicked.connect(self.on_uninstallbtn_press)
self.launcherButton.clicked.connect(self.on_launcherbtn_press)
layout = QVBoxLayout()

layout.addWidget(installed_group)
Expand All @@ -201,8 +198,6 @@ def build_ui(self):
self.uninstallButton.setEnabled(False)

button_layout = QHBoxLayout()
button_layout.addWidget(self.launcherButton)
button_layout.addWidget(spacer)
button_layout.addWidget(self.button)
button_layout.addWidget(self.uninstallButton)

Expand Down Expand Up @@ -311,7 +306,7 @@ def __init__(self, updater_dialog=False):

if updater_dialog:
self.show_updater_dialog()
self.clean_old_installs()
# self.clean_old_installs()


def clean_old_installs(self):
Expand Down
12 changes: 12 additions & 0 deletions toolbar/edu_toolset.shelf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<toolshelf name="edu_toolset" label="SideFX EDU">
<memberTool name="edu::update_toolset"/>
<memberTool name="edu::sticky_notes"/>
<memberTool name="add_bg_image"/>
<memberTool name="edu::number_items"/>
<memberTool name="labs::parameter_diff"/>
<memberTool name="labs::sticker_placer"/>
Expand Down Expand Up @@ -120,4 +121,15 @@ archive_top.setPosition(scheduler.position() + hou.Vector2(0, -1))]]></script>
<script scriptType="python"><![CDATA[import sidefxedu
sidefxedu.SideFXEDUUpdater(updater_dialog=True)]]></script>
</tool>

<tool name="add_bg_image" label="Add BG Image" icon="hicon:/SVGIcons.index?BUTTONS_add_image.svg">
<script scriptType="python"><![CDATA[from importlib import reload
import edu_utils
reload(edu_utils)
edu_utils.addBackgroundImage()
]]></script>
</tool>
</shelfDocument>

0 comments on commit 2f732ad

Please sign in to comment.