Giter Site home page Giter Site logo

indiepython / nodezator Goto Github PK

View Code? Open in Web Editor NEW
389.0 15.0 26.0 9.85 MB

A multi-purpose visual node editor for the Python programming language

Home Page: https://nodezator.com

License: The Unlicense

Python 100.00%
python3 app application desktop desktop-app desktop-application gui nodes pygame pygame-application

nodezator's People

Contributors

bmaxv avatar kennedyrichard avatar nrichards avatar pcisar avatar pmp-p avatar sefgit avatar tom-99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodezator's Issues

Inconsistent category folder handling

Some of my nodepacks have helper directories that aren't to be used as category directories. At some places I can load them, but eventually Nodezator stops me with this error.
image

Classes with inheritance as main_callable will be called with the parent __init__, not the overriden one.

Node:

from lazysocials.platforms import Twitter
from lazysocials.platforms.twitter import TwitterAuth

from lazycommon.content.types import Content

from typing import Type

main_callable = Twitter

def _Twitter(auth: TwitterAuth, max_images: {"widget_name": "int_float_entry", "widget_kwargs": {"min_value": 0, "max_value": 4}, "type": int} = 4, *types: Type[Content]) -> [{"name": "twitter", "type": Twitter}]:
        pass

signature_callable = _Twitter

Twitter:

class Twitter(Platform):
        def __init__(self, auth: TwitterAuth, max_images: int = 4, *types: Type[types.Content]):
                self._twitter_auth = auth
                self.max_images = max_images
                print(f"twitter: {types}")
                super().__init__(types)
# ...

# A chain of inheritance is formed with Platform

And the root init gets called, thus the signature is obv. incorrect and it fails.

(The first init only needs a list, while we get an int for in the Twitter class)

image

For now I can make a function that calls the init correctly, but Callable mode will not work that way obv. like so:

def _Twitter(auth: TwitterAuth, max_images: {"widget_name": "int_float_entry", "widget_kwargs": {"min_value": 0, "max_value": 4}, "type": int} = 4, *types: Type[Content]) -> [{"name": "twitter", "type": Twitter}]:
        return Twitter(auth, max_images, *types)

main_callable = _Twitter

Performance: Font caching redundantly executing Font.size()

  • Seen every time
  • Environment: Nodezator 1.3.13, M1 Macbook Pro OS 13.4, Python 3.11

Issue

Launching the app results in 3,864 calls to Font.size(" "), 24 of which are unique. According to snakeviz (usage) this takes 0.99 seconds on my computer.

Expectation

I'd expect Font.size(" ") to be called 24 times, as there is a caching system in place.

Reproduction

Count redundant executions

  1. Add to fontsman/cache.py before the 1st font.size(" "):
    1. print(f"A-{desired_height}: {font.name}")
  2. Add before the 2nd font.size(" "), inside the while
    1. print(f"B-{size}: {font.name}")
  3. run the program, see logs
  4. count all the calls to font.size, trimming any spurious leading/trailing logs (on Mac: copy log into pasteboard CMD+C, open terminal, run pbpaste | wc -l)
  5. count the unique calls to font.size (on Mac: copy log into pasteboard CMD+C, open terminal, run pbpaste | sort -u | wc -l)

Profiling

$ pip install snakeviz
$ python3 -m cProfile -o program.prof -m nodezator
$ snakeviz program.prof

Resources

font_size_for_launch.txt

image

Feature: Reload local nodes

During the development of new nodes it would be convenient, if I could reload all local nodes at once.
All nodes in the current graph would need to be redrawn, and invalid connections deleted.
Auto reloading when a node is changed, would be even better.

Dialogs can overflow the screen

Discussed in #87

Originally posted by gregismotion February 2, 2024
If I've enough errors the dialog can grow so large the OK button goes off-screen,

This could be worked around by the Enter key working for OK, but still isn't the best user experience. At this moment I've to restart the app.

image


Relevant excerpt from my reply to the original post:

I'll create an issue for it and prioritize solving this problem. I expect the patch solving the problem to be released within a week or two. The problem is fairly easy to solve because all the services needed to do so are already implemented, I just have to put what is needed together. I'll probably make it so whenever the contents of dialogs are big enough to overflow the screen they are turned into a scrollable panel.

Depending on my available time I may also use the opportunity to finish my work related to making the dialogs dismissable using the keyboard, as @gregismotion also suggested and has also been suggested in the past by other users.

Peace.

Unable to execute the graph

I placed two integer nodes before and after an “abs” node and connected them one by one. The last integer node still shows “0” after changing the value in the first node and clicking on “Execute graph”.

Overlapping submenu drawing

In some specific circumstances (which I've already identified), submenus are being drawn over each other. The behaviour can be observed in the image below:

overlapping_submenus

The bug doesn't break nodezator nor prevent people from using the menus correctly. This should not take long to fix.

Can't freely input text in widgets from `eval` nodes

  • Nodezator 1.3.11;
  • Python 3.8;
  • OS: Xubuntu (linux)

The widgets in eval nodes doesn't let you type any text you want. Instead, only text representing Python literals is allowed. To see this for yourself:

  • instantiate an eval node; for instance, right-click the canvas, then in the popup menu go to "Builtin picks" > "C-E" > eval(string_source,...);
  • then try to type something like 1+1 (you won't be able to);

If you type a Python literal though, like '1+1' or 2 it works.

This bug was first discovered by Mr. Alexander @OlegAlexander here and further examined and explained by me here.

The bug is actually not in the code, but a wrong configuration passed to the widget.

I'm sorry for the inconvenience this may have caused to some of you. I'll fix it asap.

Peace.

Attempting to choose non-utf-8 text file on text preview widget on Windows crashes

Pretty much any attempt to interact w/ the file objects crashes.

on Windows 10:

  • launch Nodezator
  • File | New --- create "test.ndz" in the user directory
  • right-click | Useful encapsulations | read_text_file
  • click on the green text folder to select a path
  • select an existing file on the desktop ("C:\Users\willa\Desktop\tolkienbooks.txt")

app vanishes

Are there crash logs or anything which will help?

Temporary broken Python exporting

The last update seems to have broken the Python exporting feature for some cases (likely when a builtin node is involved). I'm sorry for the inconvenience. It is likely a minor typo or some value I forgot to adjust. My desktop should be back from maintenance by tomorrow. I'll then be able to restore the feature right away.

Confusion on installing node packages

Hello, I was surprised that no default nodes were included in the default install:

2023-03-27 001381

The documentation only says this about how to install the node packages, but it isn't clear enough exactly what I should do to install them, and this may confuse other users:

2023-03-27 001380

Thanks, I love the idea behind this project!

'PathObject' object has no attribute 'text'

Hello,

I got this error immediately after trying clicking on "new file" or "open file" (on the splash screen or menu bar).
Version 1.12 release candidate.

python3 -m nodezator

Traceback (most recent call last):
  File "[...]/nodezator/fileman/dirpanel/main.py", line 351, in update_path_objs_appearance
    try: index = self.selectable_paths.index(
ValueError: None is not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "[...]/nodezator/__main__.py", line 113, in <module>
    main(args.filepath)
  File "[...]/nodezator/__main__.py", line 72, in main
    run_app(filepath)
  File "[...]/nodezator/mainloop.py", line 208, in run_app
    raise err
  File "[...]/nodezator/mainloop.py", line 97, in run_app
    loop_holder.handle_input()
  File "[...]/nodezator/splashscreen/op.py", line 134, in handle_input
    self.on_mouse_release(event)
  File "[...]/nodezator/splashscreen/op.py", line 175, in on_mouse_action
    else: method(event)
  File "[...]/nodezator/ourstdlibs/behaviour.py", line 559, in execute
    return func()
  File "[...]/nodezator/winman/fileop.py", line 78, in new
    paths = create_path(caption=NEW_FILE_CAPTION)
  File "[...]/nodezator/fileman/op.py", line 117, in browse_paths
    self.dir_panel.load_current_dir_contents()
  File "[...]/nodezator/fileman/dirpanel/loadop.py", line 93, in load_current_dir_contents
    self.update_path_objs_appearance()
  File "[...]/nodezator/fileman/dirpanel/main.py", line 367, in update_path_objs_appearance
    if path_obj.text == PATH_OBJ_PARENT_TEXT:
AttributeError: 'PathObject' object has no attribute 'text'

Exported python graphs give warning on Windows

When opening an exported as python graph with IDLE on Windows, I get:

Mixed newlines detected.
The file will be changed on save.

I see in graphman/pythonrepr that you use os.linesep almost everywhere, but you missed one normal newline: https://github.com/KennedyRichard/nodezator/blob/master/nodezator/graphman/pythonrepr.py#L157

However, I believe I believe it would be more correct to change out all your use of os.linesep for normal newlines.

See the os.linesep documentation:

Do not use os.linesep as a line terminator when writing files opened in text mode (the default); use a single '\n' instead, on all platforms.

I also found this handy stackoverflow post that explained it to me: https://stackoverflow.com/questions/38074811/what-is-os-linesep-for.

crash while selecting

seen on python3.11 + pygame-dev

  File "main.py", line 44, in <module>
    __main__.main(args.filepath)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/git/nodezator/nodezator/__main__.py", line 72, in main
    run_app(filepath)
    ^^^^^^^^^^^^^^^^^
  File "/data/git/nodezator/nodezator/mainloop.py", line 203, in run_app
    raise err
    ^^^^^^^^^
  File "/data/git/nodezator/nodezator/mainloop.py", line 92, in run_app
    loop_holder.handle_input()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/git/nodezator/nodezator/ourstdlibs/collections/general.py", line 18, in __call__
    for item in self: item()
                      ^^^^^^
  File "/data/git/nodezator/nodezator/winman/states/boxselection.py", line 43, in box_selection_event_handling
    APP_REFS.ea.confirm_box_selection()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/git/nodezator/nodezator/editing/selection.py", line 274, in confirm_box_selection
    self.box_select_extend_colliding()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/git/nodezator/nodezator/editing/selection.py", line 331, in box_select_extend_colliding
    self.active_obj = sample(colliding_objs, 1).pop()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/git/python-wasm-plus/devices/x86_64/usr/lib/python3.11/random.py", line 436, in sample
    raise TypeError("Population must be a sequence.  "
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

Feature Request: Support window resize of the main app window

Have tried the nodezator app and I like it very much. I have a big screen but the main widows' size is small and fixed. It would be great if the window can be resized.

I have tried to update the constants to match my screen size with no luck(My system is Windows 10, screen size is 1920 x 1080, also tried to set the text scale to 100%, 120% or 150% does not work either).

pygameconstants.py

SCREEN_WIDTH, SCREEN_HEIGHT = 1280, 720
FLAG, DEPTH = 0, 32

image

Crash when clicking on read_text_file when no file is selected

Environment:
Windows 7
Python 3.9 (backport)

Steps to reproduce:

  • Open a new file
  • Add a read_text_file node
  • Click on the file preview

The application crashes to the desktop.

Error message:

Traceback (most recent call last):
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "d:\nodezator\nodezator\__main__.py", line 95, in <module>
    parse_args_and_execute_main()
  File "d:\nodezator\nodezator\__main__.py", line 89, in parse_args_and_execute_
main
    main(filepath)
  File "d:\nodezator\nodezator\__main__.py", line 56, in main
    run_app(filepath)
  File "d:\nodezator\nodezator\mainloop.py", line 209, in run_app
    raise err
  File "d:\nodezator\nodezator\mainloop.py", line 98, in run_app
    loop_holder.handle_input()
  File "d:\nodezator\nodezator\ourstdlibs\collections\general.py", line 20, in _
_call__
    item()
  File "d:\nodezator\nodezator\winman\states\loadedfile.py", line 106, in loaded
_file_event_handling
    self.loaded_file_on_mouse_release(event)
  File "d:\nodezator\nodezator\winman\states\loadedfile.py", line 506, in loaded
_file_on_mouse_release
    obj.on_mouse_release(event)
  File "d:\nodezator\nodezator\graphman\callablenode\vizop\main.py", line 87, in
 on_mouse_action
    method(event)
  File "d:\nodezator\nodezator\widget\pathpreview\base.py", line 362, in on_mous
e_release
    self.preview_paths()
  File "d:\nodezator\nodezator\widget\pathpreview\text.py", line 140, in preview
_paths
    text = path.read_text(encoding="utf-8")
  File "C:\Python39\lib\pathlib.py", line 1266, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "C:\Python39\lib\pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "C:\Python39\lib\pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
PermissionError: [Errno 13] Permission denied: '.'

Some form of error handling would be nice. Ideally an application should never crash to the desktop.

Documentation doesn't clearly explain how to get started quickly

There are a few problems I have with the documentation.

  1. This picture is nice, but an actual practical example directory would be nice:
    image
    For example, using this: https://ascii-tree-generator.com/, you could make an example tree of what the directory should look like.

  2. How do I see the node made in the first tutorial?
    We learn how to make a node like so:
    image

, but there aren't instructions on how to load this node in and see it in the nodezator UI.

I hope you don't misunderstand, I believe this documentation I am looking for exists, but I think most users would prefer a quick start where they can write a node and see it in their window.

pygame version to be used

I suggest moving from upstream pygame to the recently branched pygame-ce. It's a good investment to make in the long run as all the contributors moved from the former to the latter. You can view the new site at https://pyga.me/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.