Manuskript available for Haiku

Good day everyone,

It’s been long since I haven’t done anything with Manuskript, apologies. In the past days I finally figured out how to make a simple C++ wrapper for python apps, just as @donn said. I finally got the time to do it, and now we are finally here, working on it again:

Manuskript

As you can see, Manuskript icon shows on the Deskbar, while Manuskript app is running, no more PythonX.Y icon and name there.

Manuskript2
And it also has the Icon in the tracker, and works with double click on it.

This is the last version of Manuskript, 0.11.0, released on January 2020.
The next step is prepare a package for testing. In the following days it will be available for local installation and testing, before any further steps.

Thanks all,
Regards,
RR

4 Likes

Good day,

It took some time, but finally there is a package of Manuskript 0.11.0 for Haiku. This is still a very early attempt, so please let me know if you have any issues with it in order to improve the package.

Here are some images from just a moment ago:
Manuskript
Right now, each time you launch Manuskript, this Alert appears, this will be removed after testing is over. I know, right now might be a bit annoying, though is just a reminder that the package is not 100% ready yet.
Manuskript2
Manuskript4

Also looks like the work of @3dEyes on the Qt theming has paid off, and now Qt apps match the dark theme, and menu is readable. Thanks @3dEyes.

I still need to figure out what to do, and how, with Manuskript’s file types. That will be for the next package revision with some other improvements.

As this is the first package I make, might be some issues with the requirements file, so if you can’t install it, let me know, report the issue.

Thanks all,
Regards,
RR

3 Likes

@Knez, the package is already available for testing. Let me know any issues you find:
https://www.dropbox.com/s/77ar2dd65apdlmo/Manuskript-0.11.0.hpkg?dl=0

Regards,
RR

1 Like

Reminder: it is not recommended to download and install packages from links in the forum. Use with caution.

(as usual, not targetting or suspecting you in particular to be malicious, it’s just good practise to keep in mind)

Oh, I misread and went to HaikuDepot to check it. Now I understand why I couldn’t find it :slightly_smiling_face:

It would be great if this app would make its way into the HaikuDepot catalog.

I’m flattered :blush::blush::blush: … I remember belonging to a hacking group, IIRC was called the haikumvengers… Almost a year for a simple C++ wrapper… :rofl::rofl::rofl::rofl: I see my future searching for jobs in the hacking side… :joy::joy::joy: Just joking!.. :wink:

Actually, you are right. Never thought about it though. When I have the next step complete I will look into deploying the package into HaikuDepot or the Software’s owner website, or both. Hopefully it won’t take almost another year… :smile:

Regards,
RR

Good day,

Some improvement from last time. Now the Manuskript created file has its own icon, instead of a compressed file one. Not sure if will be the final design though:

ManuskriptFile

Double clicking on the file icon, (Test.msk) opens Manuskript, as expected, but does not open the Test.msk file. Also as expected, the app is a wrapper around Python, so I presume I must tell the wrapper to pass the file to the inner python app.

It couldn’t be that easy… :joy::joy::joy::joy:

Getting there though, yep, I’m a bit slow… :rofl::rofl::rofl:
Regards,
RR

3 Likes

Ah, well, that’s going to pull in a certain amount of Haiku specific functionality. Your wrapper will need to be a BApplication subclass instance to do this, and handle entry_ref values passed to its RefsReceived() member function. Unless someone knows of another way to get there. Oh, and you’d have to turn those files into Python objects, possible a Python list of Python objects depending on how your application handles multiple files.

Right off hand I can’t guess how the Haiku application dispatching system ties in with the Qt functions … are you already subclassing BApplication, or just starting the interpreter directly from main()?

Have you considered Pete Goodeve’s xicon?
Maybe not exactly what you need, but at least worth a try, and maybe looking at the sourcecode for inspiration.

Good day,

@donn, it is indeed a BApplication. While on the Awesome tutorial I didn´t use the BApplication, the Manuskript work is an evolved version of that, using the BApplication class. When the whole process is finished will post the step-by-step guide again with all the acquired knowledge for others to use, and the whole code available, of course.

@PulkoMandy, I will take a look at the xicon sourcecode as you point out. @donn @PulkoMandy, in my ignorance, what I was thinking to try is instead of a BApplication(void), have it like BApplication(filename) - pseudo code:

Call BApplication(python filename to launch)
    if filename == null
          just launch the BApplication wrapper
    else
          pass the filename to the BApplication and launch "python3 filename"

though I haven´t got into that yet. Most likely will do this weekend if get Haiku time slot. I need to figure out how to do that, as @donn noted, and check what @PulkoMandy pointed.

while process outcome != success
    me = keep working
else
   me = happy
   move to next task

Thanks both and those who replied here with hints on how to get this “far”. Hopefully will be finished soon.

Regards,
RR

Good, then you’re already set up in the dispatch model to some extent, like I guess you’re calling into Python from ReadyToRun(). So once you add a RefsReceived() method, the files will show up there.

Note that they could show up later - a RefsReceived() message could be delivered at any time, via a “drop” event, though in the scenario I think we’ve been talking about those messages will have been delivered before ReadyToRun().

Good day,

@mazbrili, almost a year later, I took a look at the recipe of Calibre… anyway… sometimes need a brain change.
It does seem a bit harder to prepare a recipe for Haikuports than to make a package for Haiku (the recipe file is loooooong), so for now I’ll stick with the package, and once the HPKG process is complete, next step is make it into a recipe to have it available to all on Haikuports.

Will do. Just a bit later :wink:

Thanks for the tip,
Regards,
RR

yes… it is bit intimidating at first time… usually i just go copy recipe that not too long and modify to my need step by step…
good luck… we waiting your recipe

Good day,

I am taking a look at the src now… WTF!?#%&… I’m gonna need a crash course on C++ and Haiku Programming injected directly into frontal lobe!!!
:rofl::rofl::rofl::rofl::rofl:

Well it’s going to take longer than expected (read+research) to get the thing working properly, though we will get there.

@donn, going through the xicon code I see what you meant by the RefsReceived… I will do the research.

Thanks!

Regards,
RR

Sorry 'bout that…!:grinning: It wasn’t the easiest code to write either! Most of the hairiness, as I remember, was in trying to handle Terminal properly, not in the fairly standard drag&drop and stuff.

It was a lonnngg time ago, but if there are any specific questions i can try to answer them! (I haven’t looked at the whole thread, so I’m afraid I don’t know your exact goals.)

RefsReceived doesn’t need to be super complicated, though there’s some things that could go wrong for a non-native C++ speaker. Example that just copies the file names to /tmp/dropfiles. Some of this is copied out of the BeOS Developer’s Guide:

#include <app/Application.h>
#include <app/Message.h>
#include <storage/Entry.h>
#include <storage/Path.h>
#include <stdio.h>
#include <stdlib.h>

struct A: BApplication {
	BList *fileList;
	A(): BApplication("application/x-test") {
		fileList = new BList();
	}
	void RefsReceived(BMessage *msg) {
		uint32 type;
		int32 count;
		msg->GetInfo("refs", &type, &count);
		if (type == B_REF_TYPE) {
			int i;
			for (i = 0; i < count ; ++i) {
				entry_ref ref;
				if (msg->FindRef("refs", i, &ref) == B_OK) {
					BEntry entry(&ref);
					BPath path;
					entry.GetPath(&path);
					fileList->AddItem(strdup(path.Path()));
				}
			}
		}
	}
	void ArgvReceived(int argc, char **argv) {
		int i;
		for (i = 1; i < argc; ++i)
			fileList->AddItem(strdup(argv[i]));
	}
	void ReadyToRun() {
		FILE *fp = fopen("/tmp/dropfiles", "w");
		int n = fileList->CountItems();
		int i;
		for (i = 0; i < n; ++i)
			fprintf(fp, "%d: \"%s\"\n", i, (char *) fileList->ItemAt(i));
		PostMessage(B_QUIT_REQUESTED);
	}
};

int
main(int argc, char **argv)
{
	A app;
	app.Run();
}

Then you have to get Haiku to register your application for the type of files you want to accept. That’s in the FileTypes preference application.

Is in the HaikuDepot now?

I don’t see it. For 64-bit, anyway.

Is the package still available?

EDIT: I’ve successfully cloned the project and succeeded to run it using the directions from the starting post of the thread. It’s still a pity that the work on the icon and on the opening files is lost.

Good day @hitech ,

The work on the icon isn’t lost. The opening files, as far as I remember wasn’t achieved at that time when I did that. I still keep all files but Manuskript has evolved into new versions. I never got to create the proper recipe, I’m still trying to figure out what a recipe does, and starting to understand it. To be honest, recipes do intimidate me a little bit, certainly until I do get to understand them, as with the first time I used Icon-O-Matic, I presume.

The Icon-O-Matic file is here:

Besides the Manuskript Icon, there I have other icons for other software I was trying, as well as some other generic icons.

At first I thought that I had to build a C++ wrapper around Python software, but in the end it looks like a proper recipe is just enough to get the software icon on the deskbar as well as the file opening thing. I did got to achieve the file association, though now I don’t remember in which thread it is. In fact, I didn’t figure out that myself, I was helped by other people here in the community @donn, @extrowerk, @Lrrr ? Can’t remember now. If I recall correctly, it had something to do with the PackageInfo file too. I have to review the work to precisely see where it was set.

Right now I’m working on a hardware project so Haiku improvement is going veeeeeery sloooowly, though eventually the hardware will run on Haiku too. :crossed_fingers:t2:

Regards,
RR