Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release editor-v4.0.0 #282

Merged
merged 27 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7488717
! Changed PySide dependency from 5.1x to >=6,<6.8
ImLucasBrown Jul 14, 2024
beb1bce
Fixes to get the code editor open
ImLucasBrown Jul 14, 2024
c5ff6e7
Fix spelling of layer manager title
MichaelAldrich Sep 19, 2024
4bb3406
* Fixed animations for PySide6
ImLucasBrown Oct 17, 2024
2e82489
* Raised python ceiling to 3.12
ImLucasBrown Oct 17, 2024
e61b288
* Raised python ceiling to 3.12
ImLucasBrown Oct 18, 2024
7cb7452
* Updated auto resource building for PySide6
ImLucasBrown Oct 18, 2024
3ba049e
... Fixed default font family name to save 300ms on load time and hus…
ImLucasBrown Nov 9, 2024
b5a442f
Merge pull request #279 from nxt-dev/features/qt/pyside_6
ImLucasBrown Nov 9, 2024
5c4210b
... Fixed crash caused by triple quotes
ImLucasBrown Nov 15, 2024
15718f6
fixed QMessageBox button logic
ImLucasBrown Nov 15, 2024
d23efd5
Fix multiline styling. Fix a wheel scroll bug on NxtCodeEditor.
qbirrer Nov 15, 2024
f1234c2
Merge pull request #280 from squarebit-studios/dev
ImLucasBrown Nov 15, 2024
c27cc13
* Updated and tested Blender Addon to support Blender 4.x
ImLucasBrown Nov 22, 2024
7d0a6ae
! The RPC server will no longer start by default, to start it you mus…
ImLucasBrown Nov 22, 2024
92f5f0b
+ Added ability to copy preferences from an older version of NXT duri…
ImLucasBrown Nov 23, 2024
1c60f0c
... Fixed Maya plugin to use the correct launch method for the main w…
ImLucasBrown Nov 23, 2024
c580cbe
set the window title so it doesn't just say "Python"
ImLucasBrown Nov 23, 2024
6818fc7
cleaned up the usage of globals
ImLucasBrown Nov 23, 2024
77f7598
Merge pull request #281 from nxt-dev/features/copy_old_prefs
ImLucasBrown Nov 24, 2024
7322439
version up for release
ImLucasBrown Nov 24, 2024
861eab7
removed Py2 things from release footer
ImLucasBrown Nov 25, 2024
58936f7
removed py2 dev env
ImLucasBrown Nov 25, 2024
7ab4fb6
updated dev env to correct versions
ImLucasBrown Nov 25, 2024
233fcc3
Updated CONTRIBUTING.md to be accurate for Py3 and PySide6
ImLucasBrown Nov 25, 2024
e8c4f32
Raised Python supported floor to 3.9 because PySide6
ImLucasBrown Nov 25, 2024
6567e1c
updated license files
ImLucasBrown Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,9 @@ Conda is best installed via [miniconda](https://docs.conda.io/en/latest/minicond
```

## Dependencies
- Python 2.7
- [Python 3.9](https://www.python.org/downloads/release/python-390/)
- [Qt.py](https://github.com/mottosso/Qt.py)
- [PySide2](https://wiki.qt.io/Qt_for_Python) 5.6 (Python 2)
- `pip install -e <path to nxt core clone>`

- Python 3.7
- [Qt.py](https://github.com/mottosso/Qt.py)
- [PySide2](https://wiki.qt.io/Qt_for_Python) 5.11.1 (Python 3)
- [PySide6](https://doc.qt.io/qtforpython-6/gettingstarted.html)
- `pip install -e <path to nxt core clone>`

## Changelog syntax
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2020 The nxt Authors
Copyright (c) 2015-2025 The nxt Authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Only clone this repo if you're [contributing](CONTRIBUTING.md) to the NXT codeba
<br>

#### Requirements
- Python >= [2.7.*](https://www.python.org/download/releases/2.7) <= [3.7.*](https://www.python.org/download/releases/3.7)
- We strongly recommend using a Python [virtual environment](https://docs.python.org/3.7/tutorial/venv.html)
- Python >= [3.9.*](https://www.python.org/downloads/release/python-390/)
- We strongly recommend using a Python [virtual environment](https://docs.python.org/3/library/venv.html)

*[Requirements for contributors](CONTRIBUTING.md#python-environment)*

Expand Down
8 changes: 4 additions & 4 deletions build/release_footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ This release includes backwards compatibility for graph versions as old as `0.45
# Installation Types
Each described installation is self contained, and produces a working nxt.
## Pip Installation
From a Python(2 or 3) environment run the following command:
From a Python 3 environment run the following command:
`pip install nxt-editor`
**Python Dependancies**
- [nxt-core](https://github.com/nxt-dev/nxt)
- [Qt.py](https://github.com/mottosso/Qt.py)
- [pyside2](https://doc.qt.io/qtforpython/index.html)
- **Windows Only** Note that pyside2 is not available for python2.7 by default on windows([details](https://wiki.qt.io/Qt_for_Python/Considerations#Missing_Windows_.2F_Python_2.7_release)). For instructions on using conda to build an environment to satifsy these dependencies please see [CONTRIBUTING.md](https://github.com/nxt-dev/nxt/blob/release/CONTRIBUTING.md#python-environment)
- [PySide6](https://doc.qt.io/qtforpython-6/gettingstarted.html)


## Blender (2.8 and newer) Installation
1. Download Blender addon (nxt_blender.zip)
Expand All @@ -23,6 +23,6 @@ From a Python(2 or 3) environment run the following command:
- By Hand: `/path/to/python.exe -m pip install -U nxt-editor`


## Maya(2019-2020) Installation/Update
## Maya(2019-2025) Installation/Update
1. Download Maya module(nxt_maya.zip)
2. Extract and follow `README.md` inside
48 changes: 13 additions & 35 deletions nxt_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,48 +36,21 @@ class StringSignaler(QtCore.QObject):


def make_resources(qrc_path=None, result_path=None):
import PySide2
pyside_dir = os.path.dirname(PySide2.__file__)
full_pyside2rcc_path = os.path.join(pyside_dir, 'pyside2-rcc')
full_rcc_path = os.path.join(pyside_dir, 'rcc')
import subprocess
this_dir = os.path.dirname(os.path.realpath(__file__))
if not qrc_path:
qrc_path = os.path.join(this_dir, 'resources/resources.qrc')
if not result_path:
result_path = os.path.join(this_dir, 'qresources.py')
msg = 'First launch nxt resource generation from {} to {}'
logger.info(msg.format(qrc_path, result_path))
import subprocess
ver = ['-py2']
if sys.version_info[0] == 3:
ver += ['-py3']
args = [qrc_path] + ver + ['-o', result_path]
try:
subprocess.check_call(['pyside2-rcc'] + args)
except:
pass
else:
return

args = [qrc_path, '-o', result_path, '-g', 'python']
try:
subprocess.check_call([full_pyside2rcc_path] + args)
subprocess.call(['pyside6-rcc'] + args)
except:
pass
else:
return
try:
subprocess.check_call([full_rcc_path, '-g', 'python', qrc_path,
'-o', result_path], cwd=pyside_dir)
except:
pass
else:
return
try:
subprocess.check_call(['rcc', '-g', 'python', qrc_path,
'-o', result_path], cwd=pyside_dir)
except:
raise Exception("Failed to generate UI resources using pyside2 rcc!"
" Reinstalling pyside2 may fix the problem. If you "
raise Exception("Failed to generate UI resources using PySide rcc!"
" Reinstalling PySide6 may fix the problem. If you "
"know how to use rcc please build from: \"{}\" and "
"output to \"{}\"".format(qrc_path, result_path))
else:
Expand Down Expand Up @@ -111,7 +84,7 @@ def _new_qapp():
return app


def launch_editor(paths=None, start_rpc=True):
def launch_editor(paths=None, start_rpc=False):
"""Launch an instance of the editor. Will attach to existing QApp if found,
otherwise will create and open one.
"""
Expand All @@ -120,18 +93,23 @@ def launch_editor(paths=None, start_rpc=True):
app = existing
else:
app = _new_qapp()
from nxt_editor.dialogs import UpgradePrefsDialogue
UpgradePrefsDialogue.confirm_upgrade_if_possible()
instance = show_new_editor(paths, start_rpc)
app.setActiveWindow(instance)
if not existing:
app.exec_()
return instance


def show_new_editor(paths=None, start_rpc=True):
def show_new_editor(paths=None, start_rpc=False):
path = None
if paths is not None:
if paths and isinstance(paths, list):
path = paths[0]
paths.pop(0)
elif isinstance(paths, str):
path = paths
paths = []
else:
paths = []
# Deferred import since main window relies on us
Expand Down
8 changes: 5 additions & 3 deletions nxt_editor/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ class EDITOR_VERSION(object):


class FONTS(object):
DEFAULT_FAMILY = 'RobotoMono-Regular'
DEFAULT_FAMILY = 'Roboto Mono'
DEFAULT_SIZE = 10


_pref_dir_name = str(EDITOR_VERSION.MAJOR)
PREF_DIR = os.path.join(USER_DIR, 'prefs', _pref_dir_name)
PREF_DIR_INT = EDITOR_VERSION.MAJOR
PREF_DIR_NAME = 'prefs'
_pref_dir_num = str(PREF_DIR_INT)
PREF_DIR = os.path.join(USER_DIR, PREF_DIR_NAME, _pref_dir_num)

NXT_WEBSITE = 'https://nxt-dev.github.io/'
36 changes: 32 additions & 4 deletions nxt_editor/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def build_widgets(self):
self.save_details_button.released.connect(self.on_save_details)

self.detail_buttons_layout = QtWidgets.QHBoxLayout()
self.detail_buttons_layout.addStretch(streth=1)
self.detail_buttons_layout.addStretch(1)
self.detail_buttons_layout.addWidget(self.save_details_button)
self.detail_buttons_layout.addWidget(self.copy_details_button)

Expand All @@ -314,7 +314,7 @@ def build_widgets(self):
self.top_right_layout = QtWidgets.QVBoxLayout()
self.top_right_layout.addWidget(self.text_label)
self.top_right_layout.addWidget(self.info_label)
self.top_right_layout.addStretch(streth=1)
self.top_right_layout.addStretch(1)
self.top_right_layout.addLayout(self.buttons_layout)
self.top_layout = QtWidgets.QHBoxLayout()
self.top_layout.addWidget(self.icon)
Expand Down Expand Up @@ -373,14 +373,16 @@ def show_message(cls, text, info, details=None):


class NxtConfirmDialog(QtWidgets.QMessageBox):
Ok = QtWidgets.QMessageBox.StandardButton.Ok
Cancel = QtWidgets.QMessageBox.StandardButton.Cancel
def __init__(self, text='Title', info='Confirm something!',
button_text=None, icon=QtWidgets.QMessageBox.Icon.Question):
"""Simple message box used for user confirmation
:param text: Title text
:param info: Main info text
:param button_text: Custom button text dict:
{QtWidgets.QMessageBox.Ok: 'Custom Ok Text',
QtWidgets.QMessageBox.Cancel: 'Custom Cancel Text'}
{QtWidgets.QMessageBox.StandardButton.Ok: 'Custom Ok Text',
QtWidgets.QMessageBox.StandardButton.Cancel: 'Custom Cancel Text'}
"""
super(NxtConfirmDialog, self).__init__()
self.setText(text)
Expand All @@ -389,6 +391,7 @@ def __init__(self, text='Title', info='Confirm something!',
self.setIcon(icon)
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.setStandardButtons(self.Ok | self.Cancel)
self.setWindowTitle(text)
if button_text:
self.setButtonText(self.Ok, button_text.get(self.Ok, 'Ok'))
self.setButtonText(self.Cancel, button_text.get(self.Cancel,
Expand All @@ -408,6 +411,31 @@ def show_message(cls, *args, **kwargs):
return False


class UpgradePrefsDialogue(NxtConfirmDialog):
def __int__(self, title_text, info, button_text):
super(UpgradePrefsDialogue, self).__init__(text=title_text,
info=info,
button_text=button_text)

@classmethod
def confirm_upgrade_if_possible(cls):

if not user_dir.UPGRADABLE_PREFS:
return
from_version = user_dir.UPGRADE_PREFS_FROM_VERSION
title_text = f'Copy version {from_version} Preferences?'
button_text = {
NxtConfirmDialog.Ok: f'Copy v{from_version} prefs',
NxtConfirmDialog.Cancel: 'Use default preferences'
}
i = ('Would you like to copy preferences from an older version of NXT?'
'\nSome things like the window layout may not be preserved.')
do_upgrade = super().show_message(text=title_text, info=i,
button_text=button_text)
if do_upgrade:
user_dir.upgrade_prefs(user_dir.UPGRADABLE_PREFS)


class UnsavedLayersDialogue(QtWidgets.QDialog):
@classmethod
def save_before_exit(cls, stage_models, main_window):
Expand Down
4 changes: 2 additions & 2 deletions nxt_editor/dockwidgets/build_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class BuildTable(QtWidgets.QTableView):
"""
def __init__(self):
super(BuildTable, self).__init__()
self.setSelectionMode(self.NoSelection)
self.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.horizontalHeader().hide()
self.verticalHeader().hide()
self.break_delegate = LetterCheckboxDelegeate('B')
Expand All @@ -342,7 +342,7 @@ def setModel(self, model):
header = self.horizontalHeader()
header.setStretchLastSection(False)
header.setDefaultSectionSize(28)
header.setSectionResizeMode(header.Fixed)
header.setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
if header.count():
column = BuildModel.PATH_COLUMN
header.setSectionResizeMode(column, QtWidgets.QHeaderView.Stretch)
Expand Down
4 changes: 2 additions & 2 deletions nxt_editor/dockwidgets/code_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def focusOutEvent(self, event):
return QtWidgets.QPlainTextEdit.focusOutEvent(self, event)

def wheelEvent(self, event):
delta = event.delta()
delta = event.angleDelta().y() / 8
if event.modifiers() == QtCore.Qt.ControlModifier:
if delta > 0:
self.set_font_size(delta=0.5)
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def paintEvent(self, event):

def get_width(self):
count = self.editor.blockCount()
width = self.fontMetrics().width(str(count)) + 10
width = self.fontMetrics().horizontalAdvance(str(count)) + 10
return width

def update_width(self):
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/dockwidgets/find_rep.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def setModel(self, model):
super(SearchResultsTree, self).setModel(model)
header = self.header()
header.setStretchLastSection(False)
header.setSectionResizeMode(header.ResizeToContents)
header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)
if self.model():
self.model().modelReset.connect(self.expandAll)

Expand Down
4 changes: 2 additions & 2 deletions nxt_editor/dockwidgets/layer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class LayerManager(DockWidgetBase):
"""Interactive tree view of the layers in the open graph.
"""
def __init__(self, title='Layer Manger', parent=None):
def __init__(self, title='Layer Manager', parent=None):
super(LayerManager, self).__init__(title=title,
parent=parent,
minimum_width=100)
Expand Down Expand Up @@ -100,7 +100,7 @@ def setModel(self, model):
header = self.header()
header.setStretchLastSection(False)
header.setDefaultSectionSize(LayerTreeView.SIZE)
header.setSectionResizeMode(header.Fixed)
header.setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
if header.count():
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
self.hideColumn(LayerModel.TARGET_COLUMN)
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/dockwidgets/output_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def __init__(self, graph_model=None, parent=None):

self.buttons_layout = QtWidgets.QHBoxLayout()
self.buttons_layout.addWidget(self.log_filter_button)
self.buttons_layout.addStretch(stretch=1)
self.buttons_layout.addStretch(1)
self.buttons_layout.addWidget(self.clear_rich_button)

self.rich_output_layout = QtWidgets.QVBoxLayout()
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/dockwidgets/property_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
QtCore.QStringListModel
except AttributeError:
del QtCore
from PySide2 import QtCore
from PySide6 import QtCore

# Internal
from nxt_editor import user_dir
Expand Down
Loading
Loading