Page 4 of 4 FirstFirst ... 234
Results 46 to 54 of 54

Thread: nuArchitect python version

  1. #46
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,433
    Ok, I just ran into a show stopper with the GUI designer... pressing f1 for the HTML help page, while bringing up the help page, crashes modeler. 2018.0.7, Windows 10 Pro 1803 (build 17134.590). Perhaps the help function needs to move to it's own button, because lightwave uses the f1 key for it's help function...

    Also, I had an idea - when a new control is added, could it read the location of the x and y guides for placement? That way, it becomes move guides, add control, repeat as needed. Perhaps as an option? Ideally it should all be drag and drop (like QT Designer, Visual Studio and #Develop's forms designer), but such may not be possible under LW_Python....
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  2. #47
    Registered User
    Join Date
    May 2017
    Location
    Lampertheim, Germany
    Posts
    117
    Quote Originally Posted by Kryslin View Post
    Perhaps the help function needs to move to it's own button, because lightwave uses the f1 key for it's help function...
    At the moment I am working on a new release for the nuArchitect bundle. As it will have complete new UI (using tab in tab) and some new (own controls) the nuGUIDesign will become evtl a complete new Interface and maybe it will be dedicated from the rest. As I must work in any case with the code, I will switch over to an other key for the help. Thank you for reporting this.

    Quote Originally Posted by Kryslin View Post
    Also, I had an idea - when a new control is added, could it read the location of the x and y guides for placement? That way, it becomes move guides, add control, repeat as needed. Perhaps as an option? Ideally it should all be drag and drop (like QT Designer, Visual Studio and #Develop's forms designer), but such may not be possible under LW_Python....
    Have a look at the "Add" Tab. There you can define things like this. There you can define how new controls are named, where they are positioned, the dimensions. Here you can do even a rename of the variables etc. Maybe this is what you have in mind with "read the location of x and y"
    If a control is added, you can drag it around (using the right mouse button)... I am not shure what you mean with drag and drop. But I find the idea really nice. I will think about a tab with"Dummy" controls, that can be used as Drag and Drop source for new controls.

    Python is fast enough to handle things like this. Thank you for the idea, I will try to implement this.
    As the next generation of nuGUIDesign will be able to generate code for the "nuLib" too (can be choosen between "Standard UI" and "nuLib UI") I must code it from the scratch, what makes it more easy to implement such things. But this can take a while.

    I hope this helps you and gives you some anticipation to the next generation of nuGUIDesign.

    Regards,
    Kanuso

  3. #48
    Super Member JohnMarchant's Avatar
    Join Date
    Mar 2003
    Location
    Murcia, Spain
    Posts
    2,865
    Look forward to it Kanuso
    Dell XPS 15
    15.6-inch (3840 x 2160) 4K 282ppi IPS LCD
    Intel i7 7700HQ 2.8GHz
    Windows 10 64Bit
    NVidia GeForce GTX 1050 Ti
    1TB SDD
    32Gb Ram

    LightWave 2018.4

    Very nice Laptop

  4. #49
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,433
    Wow, I learn something new, large or small, every day (right click and drag to position controls). Thank you for considering my ideas. Yes, you've got the idea correct - simply dragging a control from a tool bar, onto a blank panel, and dropping it adds the control to the panel. The other thing would be to make it respect the x and y snap values.

    Still, even the current one saves a lot of time setting up a panel for use in python, so thank you very much.
    (Adds Kanuso to the list of people I need to donate money to...)
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  5. #50
    Registered User
    Join Date
    May 2017
    Location
    Lampertheim, Germany
    Posts
    117
    I have looked deeper for the issue with opening the help in the GUI-Designer.
    This issue does not only hit the GUI-Designer. It seems like LW doesn't want a command like "os.startfile" (this is the old way to open a external program). I don't know why it works sometimes and sometimes not. But I have tried some other ways to call an external programm. The old way didn't take care of the os and works on all platforms I know.
    I will use the new way in the future (even if there must be taken care to many other things)

    For interested ones:

    Code:
    import os
    import sys
    import subprocess
    ...
    def callprogram(filepath):
        if os.name is "nt":
            subprocess.Popen(filepath,shell=True,stdin=None,stdout=None,stderr=None,close_fds=True)
        elif sys.platform.startswith("darwin"):
            subprocess.call("open",filepath)
        else:
            subprocess.call("xdg-open",filepath)
    The long parameterlist in the "nt" part is to not show the "cmd" window. Because in default the cmd window captures the stdin/stdout and stderr, it will block the calling process. This parameters tells the cmd-window to not do so. So we have a non blocking open of an external program.

    The next generation of nuArchitect and nuGUIDesign will use the new way, so I hope this problem doesn't occure anymore.

    I have tested the old way with a "minimal" python and it crashes too, so I think LW has a problem with the old way. So if anyone wants to start an external program, than the new way should be used (in the python forums the new way is preferred anyway).

    Regards,
    Kanuso
    Last edited by KANUSO; 02-23-2019 at 01:26 AM.

  6. #51
    Registered User
    Join Date
    May 2017
    Location
    Lampertheim, Germany
    Posts
    117
    Quote Originally Posted by Kryslin View Post
    Ok, I just ran into a show stopper with the GUI designer... pressing f1 for the HTML help page, while bringing up the help page, crashes modeler. 2018.0.7, Windows 10 Pro 1803 (build 17134.590). Perhaps the help function needs to move to it's own button, because lightwave uses the f1 key for it's help function...
    If you want a quick help, than you can change the file __init__.py in the folder "nuArchitect\guiedit"
    In this file find the function "def dohelp(self,tabnr)"
    in this function change the line "os.startfile(file)"
    for NT to:
    subprocess.Popen(file,shell=True,stdin=None,stdout =None,stderr=None,close_fds=True)
    for MAC to:
    subprocess.call("open",file)
    for Linux to:
    subprocess.call("xdg-open",file)

    At the top of this file insert a line:
    import subprocess

    This should work as quick help

    Don't forget to restart LW after this.

    Regards,
    Kanuso

  7. #52
    Registered User
    Join Date
    May 2017
    Location
    Lampertheim, Germany
    Posts
    117
    Hello together,

    I have spend a complete day to find out how to install PyPNG so that it can be used from LW. Of course the Modeler. Because I didn't find a way to save an image with on bord Modeler functions I had implemented a very simple interpretation of TGA to the nuArchitect scripts. But that wasn't really the finest. So I searched about image file formats in the internet. And so I found PyPNG. A pure Python library to handle PNG files. Oh, fine I don't had to reinvent the wheel. Said and downloaded... But this was only the first step in a walk through the deeper hells of (LW) Python. I did do many (unsuccessful) tries to let it work in LW. But finally I've done. Maybe this is not the correct way, but if you don't find anything about it in the docs and/or the internet, than you take what you get. For all who are interested in...

    This is the way that works for me (and the nuArchitect scripts):
    Download the pypng library from https://pypi.org/project/pypng/
    Do whatever must be done to get normal files and folders (not compressed)
    in my case it was a file named pypng-pypng-0.0.19.tar.gz
    on that tar.gz was embeded pypng-pypng-0.0.19.tar
    in this tar was embeded pypng-pypng-0.0.19 this was the folder i had extracted to a temporary folder
    after getting a closer look to what was in this temporary folder, I noticed a folder "code"
    This folder I had copyed to "LW-Install"/bin/Lib/site-packages (where "LW-Install" is the path where you have installed LW
    After it was placed in this LW-Python "look for extensions" folder, I renamed "code" to "PyPNG"
    Than I had entered this folder and created a file in it named "__init__.py"
    You can leave this file empty, but it must be found there (this I was aware after endles internet searches)

    This are the steps to let you work with PyPNG. And this are the steps that one must do to let the next versions of nuArchitect scripts use PNG as alternative to TGA (which saves a lot of disc-space)

    I even tried PIL (Python Image Library) with this library this didn't work the same way. It seems that if you do an "from PIL import image" the library tries to do something, that LW don't like and so it ends in an error. If someone had found a way to implement PIL in LW, please let me know how.

    The PyPNG library will not be shipped with the nuArchitect bundle (I don't know if this breaks some laws, so everybody must do the above steps the get PNG with the next version of nuArchitect. Currently I am working on new docs to the scripts there are to much changes to let the old ones be alive.

    Regads
    Kanuso
    Last edited by KANUSO; 03-13-2019 at 05:43 AM.

  8. #53
    Registered User
    Join Date
    May 2017
    Location
    Lampertheim, Germany
    Posts
    117
    Because I don't was able to get the PIL-Library installed in LW-Python, I have installed Python 2.7 parallel. So I have searched for way to handle external python scripts. At this search I find a way to let the nuArchitect scripts handle an interface to other python installations. I don't know if this works with other pythons than Python 2.7. But with this python will it work as so as I thought.
    For example...
    I wrote a script for python 2.7 that works with PIL.
    I was able to call this script from within a nuArchitect script.
    There can be parameters reached over to the script and the output of 'print' that script does can be shown in nuArchitect after the script has ended (even errors are shown)

    So now my question:
    Is there interrest in adding this to nuArchitect scripts, or am I the only one who will find this cool?

    Looking to the future, this may for example be useful to let the nuArchitect scripts handle other fileformats than "TGA" for UV-Images.
    Or (looking far into future) there can be a bunch of scrits that can create wall textures etc...

    Regards,
    Kanuso
    Last edited by KANUSO; 03-15-2019 at 07:01 AM.

  9. #54
    Super Member JohnMarchant's Avatar
    Join Date
    Mar 2003
    Location
    Murcia, Spain
    Posts
    2,865
    Thanks for the updates Kanuso
    Dell XPS 15
    15.6-inch (3840 x 2160) 4K 282ppi IPS LCD
    Intel i7 7700HQ 2.8GHz
    Windows 10 64Bit
    NVidia GeForce GTX 1050 Ti
    1TB SDD
    32Gb Ram

    LightWave 2018.4

    Very nice Laptop

Page 4 of 4 FirstFirst ... 234

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •