Stephan3 / dwc2-for-klipper

A translator between DWC2 and Klipper
GNU General Public License v3.0
160 stars 38 forks source link

Put all klipper macros inside dedicated folder #10

Closed danielfmo closed 4 years ago

danielfmo commented 5 years ago

Klipper macros are always shown on all folders inside /macros

This fixes it by creating a dedicated folder "Klipper" and showing the macros only inside this folder, allowing to organize other custom macros.

Sorry but my IDE does a trim on save, this the white spaces removed also

Stephan3 commented 5 years ago

As i´ve told on discord. personaly i use the klipper macros a lot so its nice to have em upfront. additionaly the support jinja2, which the dwc2 ones dont.

danielfmo commented 5 years ago

I can agree with you but please take into consideration the following: 1 - Currently klipper macros are shown inside all folders, for example if I create a folder to put DWC2 macros inside the klipper macros are also shown inside. 2 - even with the klipper macros inside a dedicated folder, one can have them always upfront as DWC2 keeps the folder open.

In any case I think that it is not ideal to show klipper macron on all folder and it can be fixed. If you prefer, klipper macros can be allays shown only in the "root" of the macros folder and thus allowing the user to create folders for other things.

Note: I want to use DWC2 macros because I intent to allow it to run system commands like shutdown from the gui. Thus the need to "organize" the macros

Stephan3 commented 5 years ago

I see. Please make the folder a virtual folder, as the macros are also virtual and never writen. Your code is generating an used dir on users disk.

danielfmo commented 5 years ago

@Stephan3 please take a second look and tell me what you do think about it.

Stephan3 commented 5 years ago

I reviewed that one. It still lack the situation where a virgin disk User passing by. If dwc is requesting a directory, it has to be created.

If this isn’t there , dwc settings aren’t saved for those users.

danielfmo commented 5 years ago

Any hints on how achieve that then? If I keep the os.makedirs(path)_ at the beginning it will create also the folder for the klipper macros.

Stephan3 commented 5 years ago

Make an and statement. If path not exists and path is not Klipper macro.. so this way or similar

Stephan3 commented 4 years ago

I am going to close this