Posts: 1,228
secipolla
Joined: 15 Jun 2008
#1
/usr/local/bin/antix2usb-gui.py has some lines for a help button. They are commented out now but I have made a small help page and would like to know if anyone knows the comand to launch, say, /usr/share/antix2usb/help.html. It would go between the two help button lines.
The lines are:

Code: Select all

        #----------------------------------------------------------------------
        # Button Row
        #
        buttonRow = gtk.HButtonBox()   
        buttonRow.set_border_width(BORDER_WIDTH)

        # Set the appearance of the Button Box
        buttonRow.set_layout(gtk.BUTTONBOX_SPREAD)
        spacing = 10
        child_w = 30
        child_h = 20
        buttonRow.set_spacing(spacing)

#        helpButton = gtk.Button(stock = gtk.STOCK_HELP)
#        buttonRow.add(helpButton)

        cancelButton = gtk.Button(stock = gtk.STOCK_CANCEL)
        cancelButton.connect("clicked", self.on_cancel_button_clicked)
        buttonRow.add(cancelButton)

        applyButton = gtk.Button(stock = gtk.STOCK_APPLY)
        applyButton.connect("clicked", self.on_apply_button_clicked)
        buttonRow.add(applyButton)        

        mainVBox.pack_start(buttonRow, True, True, 0)
        buttonRow.show()

        self.mainWindow.set_position(gtk.WIN_POS_CENTER)
        self.mainWindow.show_all()

    def update(self, data):
        debug("AntixUsbLiveGui.update")
        if DO_DEBUG:
            data.print_params()
        #adj = gtk.Adjustment(lower = data.partitionMinSize, upper = data.partitionMaxSize)
        #self.partitionSizeSpinButton = gtk.SpinButton(adj)
        self.partitionSizeSpinButton.set_range(data.partitionMinSize, data.partitionMaxSize)
        self.partitionSizeSpinButton.set_value(data.partitionSize)
        self.persistenceCheckButton.set_active(data.persistence)
Posts: 200
lagopus
Joined: 15 Oct 2008
#2
hello secipolla!

I have a"still-in-development" version of the python script... with a working, simple, help dialog...
but I did not find the time to polish and package it.

What is the the version of the script you have? (I presume you got the version delivered with antiX 8.5, I am still using 8.2)

Please have a look at the attached archive.
Posts: 1,228
secipolla
Joined: 15 Jun 2008
#3
Hi lagopus, the package you posted is empty. Anyway, the version I have is already 0.3.0. I don't know if the English is the same version but the Portuguese is because I worked on the translation and testing with it.
I asked anti to comment lines 507-508 so the help button wouldn't show up since there was no help page.
Now I made one (only Portuguese yet) and would like that the help button opened it with dillo or with x-www-browser. It could be placed in /usr/local/share/antix2usb/html/ajuda.html (then if anti wants to put it somewhere else we just tweak the address).

Please have a look and, if it's ok, insert the command to open it.
Posts: 200
lagopus
Joined: 15 Oct 2008
#4
Sergio

Sorry for the mistake, the package is not a tar.gz file, just a tar file.
Rename it and untar.

Do not take attention to the version numbering
This version (experimental) uses gettext for localisation

In the file antix2usb-gui.py, search for the string :"help"

Code: Select all

        helpButton = gtk.Button(stock = gtk.STOCK_HELP)
        helpButton.connect("clicked", self.on_help_button_clicked)
        buttonRow.add(helpButton)
You should define on_help_button_clicked() in the AntixUsbLiveGui class:
something like:

Code: Select all

   
    def on_cancel_button_clicked(self, widget):
        debug("on_cancel_button_clicked: close_application")
        close_application()
        return

    def on_help_button_clicked(self, widget):
        help_dialog(HELP_TEXT)
Replace the call to the help_dialog method:

Code: Select all

        help_dialog(HELP_TEXT)
by:

Code: Select all

        os.sytem(my-help-command)
where my_help_command is a quoted string looking like:

"path-to-my-browser path-to-my-html-help-file &"

I presume we have to add the '&' if we don't want to freeze the gui until the browser is closed.

Not tested !

I think a html help page is better than a help string, but the problem is with the packaging of the app, the place of the files...
Just try it and take care of the indentation !!

Yves
Posts: 1,228
secipolla
Joined: 15 Jun 2008
#5
Thanks lagopus. I missed you saying about the simple help dialog, I'll check it.
As soon as I boot to antiX i'll test both the app and the call to a browser.
Posts: 1,228
secipolla
Joined: 15 Jun 2008
#6
The command to launch the browser works fine, thanks. And it doesn't freeze the USB installer.
I tested it in the original script. Tomorrow I test your new one.
Cheers.

P.S. for the page it's just put it and the images together in the same folder (then adjust the image links, I don't know if they're relative or absolute).
Posts: 1,228
secipolla
Joined: 15 Jun 2008
#7
Hi lagopus, the localization seems to be working ok. Only missing things are the CONFIRM_OR_CANCEL_MESSAGE and the HELP_TEXT (if it will use it instead of a html file).
There's one problem with the script though. It gets the first part of the system locale code to use for GRUB's cheatcode, so in a pt_BR system it would put lang=pt in the kernel line instead of lang=br. See
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"antix.freeforu ms.org/post14230.html?hilit=antix2usb%20gui.py#p14230"
linktext was:"antix.freeforu ms.org/post14230.h ... .py#p14230"
====================================

For antiX 8.5 we hacked that since I had to translate the script anyway, see
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"antix.freeforu ms.org/post14305.html?hilit=antix2usb%20gui.py#p14305"
linktext was:"antix.freeforu ms.org/post14305.h ... .py#p14305"
====================================

Maybe you can fix that.
Regards.