Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 26 Sep 2017, 14:32
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Business
Wrapper for SQLiteManager extension in MZ browsers
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
musher0


Joined: 04 Jan 2009
Posts: 10838
Location: Gatineau (Qc), Canada

PostPosted: Sat 05 Aug 2017, 15:17    Post subject:  Wrapper for SQLiteManager extension in MZ browsers
Subject description: May be interesting to have since databasing has never been Puppy's forte!
 

Hello all.

Please find attached a wrapper script which will enable you to run as a
stand-alone app the SQLiteManager extension available on some Mozilla-
type browsers. (E.g. Firefox, SeaMonkey, and similar.)

This is an overblown Wink edit of a one-liner written by BK way back when.

~~~~~~~~~~

Requirements --
-- A Mozilla-type browser

-- its SQLiteManager extension.

-- The new yaf-splash utility (all Puppies have it now).


Features --
-- It checks if you have the extension and then an MZ browser; tells you
if you don't and exits.

-- SQLiteManager.desktop file provided for convenience; will show in
Business or Database sub-section of your menu.

-- Issues messages in console if run from console, through yaf-splash
if run from X


Peculiarity --
-- If you have installed the SQLiteManager extension, say, in Light and in
SeaMonkey, it will run the first one it finds (In alphabetical order) and exit

~~~~~~~~~~

Constructive or improvement-oriented comments welcome.

Enjoy.

~~~~~~~~~~
Code:
#!/bin/sh
# sqlitemanager.sh
# Original script by Barry Kauler, 2009? ;-)
# Edited for MRUF-lst by musher0. # Edit 2: 2017-08-05, 13 h 55. GPL3
# Please see https://opensource.org/licenses/GPL-3.
####

# Note --
# Sqlitemanager does not have position handling for the command line.
# We should try to "cd" as close as we can to the DB file before running it.

case "${LANG:0:2}" in fr)TXTMSG3="
    SQLiteManager se lance.

... Merci de votre patience ...
"
TXTMSG4="
On n'a trouvé aucun navigateur
   qui supporte sqlitemanager.
"
TXTMSG5="
SQLitemanager n'est pas installé.
" ;;
         en|*)TXTMSG3="
SQLiteManager is launching.

   ... Thanks for waiting ...
"
TXTMSG4="
  No browser was found
to support sqlitemanager.
"
TXTMSG5="
SQLitemanager is not installed.
" ;;
esac

PasInstalle () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG5" &
   }

PasTrouve () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG4" &
   }

Attente () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG3" &

# Why bcm is not showing any text for this, I don't know.
# But I'm leaving the code here in case someone does.
# bcm -u /usr/local/share/pixmaps/5817-64_SQLiteManager.png -a 1 -g c:c -d 6 -b "#000000FF" -c "#0c0c0c8F" -t "<span font='LiberationSerif Bold Italic 18' color='$Color1' gravity='north' gravity_hint='line'>"$TXTMSG3"</span>" 2>/dev/null &
   }

MZBrwsrChck () {
   if [ "`which $BrowseR`" = "" ];then
      if [ -t 1 ];then echo "TXTMSG4"
      else PasTrouve
      fi
   else # sqlitemanager is launched
      SqliT="chrome chrome://sqlitemanager/content/sqlitemanager.xul"
      [ -t 1 ] && echo "$TXTMSG3" || Attente
      $BrowseR --$SqliT 2>/dev/null
      exit # The script runs the first SQLiteManager it finds and exits.
   fi; }

## Action
for brwsr in light mozilla # We can add palemoon, etc.
do   S="`tree -fi ~/.$brwsr/* -L 3 | grep SQLite`"
   if [ "${S}" ];then BrowseR="`echo "$S" | awk -F"/" '{ print $4 }'`"
      MZBrwsrChck
   else
      if [ -t 1 ];then echo "STXTMSG5."
      else PasInstalle
      fi
   fi
done

~~~~~~~~~~
SQLiteManager-wrapper-0.1.pet
Description 
pet

 Download 
Filename  SQLiteManager-wrapper-0.1.pet 
Filesize  3.22 KB 
Downloaded  17 Time(s) 

_________________
musher0
~~~~~~~~~~
« La vraie justice serait d'emm...r pelo autant qu'il nous emm...e. » (Moi) /
"True justice would be to annoy pelo as much as him us." (Me)
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8241
Location: Perth, Western Australia

PostPosted: Sun 06 Aug 2017, 05:15    Post subject:  

I have a problem in Quirky 8.3 and Easy, have this pet for SQLiteManager:
http://distro.ibiblio.org/quirky/quirky6/noarch/packages/pet_packages-noarch/mozilla_addon_SQLiteManager-0.8.3.1-all.pet

If I start seamonkey from a terminal, I see a message that SQLiteManager is a foreign extension and is being disabled.

That means it won't run standalone either.

Have to start SeaMonkey, go to Addons Manager in the menu, and click the button to enable SQLiteManager.

Consequently, I have created a new /usr/bin/sqlitemanager.sh that tests if the addon has been enabled:

Code:
#!/bin/sh
#sqlitemanager is an addon for mozilla browsers.
#want to start it standalone.

export TEXTDOMAIN=sqlitemanager
export OUTPUT_CHARSET=UTF-8

SQLflg=''
for aINI in `ls -1 /root/.mozilla/*/*/extensions.ini | tr '\n' ' '`
do
 SQLflg="$(grep -o 'SQLiteManager' $aINI)"
 [ "$SQLflg" ] && break
done

if [ ! "$SQLflg" ];then
 MSG1="$(gettext 'Sorry, SQLiteManager is disabled. You need to run the Mozilla browser first, choose Addons Manager, and enable SQLiteManager addon.')"
 popup "background=#ff8080 level=top terminate=ok|<big>${MSG1}</big>"
else
 BROWSER="$(echo -n $aINI | cut -f 4 -d '/')" #ex: seamonkey
 exec ${BROWSER} -chrome chrome://sqlitemanager/content/sqlitemanager.xul
fi

###END###


The only problem that I can see with that script, is it relies upon the browser name to be /root/.mozilla/seamonkey, /root/.mozilla/firefox, etc.
It works for seamonkey, but I don't know if the other Mozilla browsers create a directory named like that, for example, does palemoon create /root/.mozilla/palemoon?
[/code]

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 10838
Location: Gatineau (Qc), Canada

PostPosted: Sun 06 Aug 2017, 06:27    Post subject:  

Hello BarryK.

Strange... I never had a problem running SQLiteManager stand-alone with my script
above or with your old one-liner.

I have never had to enable it before use either. It installed, I clicked on the menu entry,
and away I went. Maybe I forgot?

In any case, one enables something only once. The next times, one shouldn't have to.
This is the concept of enabling, I believe? It's strange that you would have to enable it
every time you use it, inside the browser or stand-alone.

I must say I tend to stick to 32-bit environments. Perhaps this is the reason? Different
behavior for different environments?

~~~~~

In answer to your question about where the user dirs are in MZ browsers, this much
I know:

Name ................................ 1st level....... 2nd level (user profile)

Mozilla-Light (aka "Light") .. ~/.light ...... ~/.light/light/RandomNumber
Firefox............................... ~/.mozilla ... ~/.mozilla/firefox/RandomNumber
SeaMonkey ........................ ~/.mozilla ... ~/.mozilla/seamonkey/RandomNumber

In Light, this is where the SQLiteManager extension is on my DPupStretch-7:
/root/.light/light/3xijgjry.default/extensions/SQLiteManager@mrinalkant.blogspot.com.xpi
Mutatis mutandis for the other MZ browsers. Otherwise the author would have gone nuts.

I'm not familiar with Pale Moon. I think it uses the dir name ~/.MoonChild Productions
(with the space) for the 1st level. Beyond that, I'd rather let an experienced user
provide the answer.

~~~~~

IHTH.

_________________
musher0
~~~~~~~~~~
« La vraie justice serait d'emm...r pelo autant qu'il nous emm...e. » (Moi) /
"True justice would be to annoy pelo as much as him us." (Me)
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10838
Location: Gatineau (Qc), Canada

PostPosted: Sun 06 Aug 2017, 06:47    Post subject:  

Hello again BarryK.

This is what I get when I run my script:
Quote:
1502016074761 addons.webextension.{72b2e02b-3a71-4895-886c-fd12ebe36ba3} WARN Loading extension '{72b2e02b-3a71-4895-886c-fd12ebe36ba3}': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
1502016074853 addons.webextension.{72b2e02b-3a71-4895-886c-fd12ebe36ba3} WARN Please specify whether you want browser_style or not in your browser_action options.
1502016075006 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing background.persistent: Event pages are not currently supported. This will run as a persistent background page.
1502016075042 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
1502016075043 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing version_name: An unexpected property was found in the WebExtension manifest.
1502016075043 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing options_page: An unexpected property was found in the WebExtension manifest.
1502016075564 addons.webextension.firefox@ghostery.com WARN Please specify whether you want browser_style or not in your browser_action options.
Screenshot attached.

BFN.
This-is-what-I-get.jpg
 Description   
 Filesize   159.27 KB
 Viewed   84 Time(s)

This-is-what-I-get.jpg


_________________
musher0
~~~~~~~~~~
« La vraie justice serait d'emm...r pelo autant qu'il nous emm...e. » (Moi) /
"True justice would be to annoy pelo as much as him us." (Me)
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8241
Location: Perth, Western Australia

PostPosted: Sun 06 Aug 2017, 20:55    Post subject:  

musher0,
You would have SQLiteManager already enabled, as you installed it from a running browser.

However, in my case it is a PET, which is different.

Running my script, there are no error messages. But then, I have used the latest version of SQLiteManager from the source repository -- I think I posted a link on my blog.

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 10838
Location: Gatineau (Qc), Canada

PostPosted: Mon 07 Aug 2017, 04:49    Post subject:  

Hello BarryK.

Personally, I don't see a problem. To be frank, I even see it as splitting hairs.

Simply mention to the user that (s)he has to enable SQLiteManager from
his/her browser after the petget has installed the extension? (I believe you
already did in one of your SQLIteManager articles on your blog?)

Or perhaps discuss the issue with "lazierthanthou", the developer of
SQLiteManageron github? Maybe he can incorporate in his code a "sensor"
or "hook" to detect the stand-alone situation and accommodate the user.

Hopefully, we are talking about the same thing.

A few years ago, one could download and install a stand-alone SQLite
Manager that ran separately from any MZ browser, like ThunderBird or
Kompozer did. It had the MZ "heart" (the famous "xul"). IIRC, that version
ran fine on first run without need for enabling.

There now is a similar SQL utility with the same name, but limited to
WhineDose and Mac systems. It appears to be from a company rather
than from a soloist developer.

Sorry I couldn't help you more on this. Best of luck.

BFN.

_________________
musher0
~~~~~~~~~~
« La vraie justice serait d'emm...r pelo autant qu'il nous emm...e. » (Moi) /
"True justice would be to annoy pelo as much as him us." (Me)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Business
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1750s ][ Queries: 13 (0.0111s) ][ GZIP on ]