OpenSmock / Pyramid

Pyramid is a Graphical User-Interface (GUI) builder and editor for Bloc and Toplo.
MIT License
29 stars 5 forks source link

Add plugin copy/paste to manage OS clipboard input/output #159

Open labordep opened 3 months ago

labordep commented 3 months ago

The idea is to propose a plugin to manage interactions with the operating system clipboard. This feature have a high value for UI designer, but in Pharo the way to manage the clipboard is not "clear". Actually for Windows we have a project to do that (https://github.com/OpenSmock/OS-Windows), and it works nicely. But I don't know how to do that for others platforms. May be we need to have a common API, OS agnostic, to manage that.

In consequence this is necessary to propose a Pyramid plugin with a good level of front-end API to manage that, because the clipboard management backend can change depending decision of that in Pharo. This clipboard management can be implemented in an other project to support the interaction with the OS. The Pyramid plugin can use this project to exploit the clipboard. This is a reflexion to have with @ELePors.

About features in Pyramid, copying a BlElement should fill the clipboard with theses capacities:

Actual use-cases: Copy a BlElement from Pyramid and paste it in a mail as an image.

@Nyan11 what is actually available ?

Nyan11 commented 3 months ago

You can add custom menu in a plugin with:

"Create a Pyramid plugin"

Object << #PyramidQuickMenu
    traits: {TPyramidPlugin};
    slots: {};
    tag: 'plugin-space';
    package: 'Pyramid-Bloc'
"In the connectOn: method do ->"
connectOn: aPyramidEditor

    (aPyramidEditor window services at: #selectionMenu) addItem: [
        :aBuilder | self menuFor: aBuilder ]
"In the menuFor: do ->"

menuFor: aBuilder

    aBuilder
        addGroupEmptySelection: [ :group :empty |
            group
                addItem: [ :item |
                    item
                        name: 'i am a menu for nothing';
                        enabled: true;
                        action: [ self inform: 'nothing' ];
                        yourself ];
                yourself ]
        order: 40.
    aBuilder
        addGroupSingleSelection: [ :group :single |
            group
                addItem: [ :item |
                    item
                        name: 'i am a menu for single';
                        enabled: true;
                        action: [ self inform: single printString ];
                        yourself ];
                yourself ]
        order: 40.
    aBuilder
        addGroupMultiSelection: [ :group :multi |
            group
                addItem: [ :item |
                    item
                        name: 'i am a menu for mutli';
                        enabled: true;
                        action: [ self inform: multi size printString ];
                        yourself ];
                yourself ]
        order: 40
Nyan11 commented 1 month ago

You can also export a Bloc design as a Form and then transform the Form as a png. I do not know if others export format exist.