Check-in [5e592eeebf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:5e592eeebf2878865a6aac31af20ffca3c08f318
Date: 2012-05-29 14:47:04
User: BarryK
Comment:ppm: optional app thumbnail icons displayed alonside each pkg entry

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/usr/local/petget/configure.sh

@@ -5,10 +5,11 @@
 #configure package manager
 #110118 alternate user interfaces.
 #120203 BK: internationalized.
 #120210 01micko: Ziggy ui crashes if *all* repos unticked here (no one would do that, but it is still a bug).
 #120515 in some cases, Packages-puppy-${DISTRO_FILE_PREFIX}-* may not exist (ex, Racy only has Packages-puppy-wary5-official).
+#120529 checkbox to display app thumbnail icons.
 
 export TEXTDOMAIN=petget___configure.sh
 export OUTPUT_CHARSET=UTF-8
 
 #export LANG=C
@@ -50,10 +51,19 @@
  UI_RADIO="${UI_RADIO}<radiobutton><label>${ONEUI}</label><action>echo -n ${ONEUI} > /var/local/petget/ui_choice</action></radiobutton>"
 done
 
 #  <text><label>Choose an alternate User Interface:</label></text>
 
+#120529 note, same code in pkg_chooser.sh, so probably this not req'd...
+if [ -f /var/local/petget/flg_appicons ];then
+ FLG_APPICONS="`cat /var/local/petget/flg_appicons`"
+else
+ #test if pet installed with set of 16x16 app icons...
+ [ "`grep 'icons_puppy_app' /root/.packages/woof-installed-packages /root/.packages/user-installed-packages`" != "" ] && FLG_APPICONS='true'
+fi
+[ "$FLG_APPICONS" = "" ] && FLG_APPICONS='false'
+
 export CONFIG_DIALOG="<window title=\"$(gettext 'Puppy Package Manager: configure')\" icon-name=\"gtk-about\">
 <hbox>
 
 <vbox>
  <frame $(gettext 'Update database')>
@@ -65,10 +75,11 @@
   <text><label>$(gettext "Warning: The database information for some repositories is quite large, about 1.5MB for 'slacky' and several MB for Ubuntu/Debian. If you are on dialup, be prepared for this.")</label></text>
   <text><label>$(gettext 'Technical note: if you would like to see the package databases, they are at') /root/.packages/Packages-*. $(gettext 'These are in a standardised format, regardless of which distribution they were obtained from. This format is considerably smaller than that of the original distro.')</label></text>
  </frame>
  <frame $(gettext 'User Interface')>
   ${UI_RADIO}
+  <checkbox><label>$(gettext 'Show application thumbnail icons')</label><variable>CHK_APPICONS</variable><default>${FLG_APPICONS}</default></checkbox>
  </frame>
 </vbox>
 
 <vbox>
  <text use-markup=\"true\"><label>\"<b>$(gettext 'Requires restart of PPM to see changes')</b>\"</label></text>
@@ -102,10 +113,26 @@
 #  CHECK_ubuntu-intrepid-multiverse="true"
 #  CHECK_ubuntu-intrepid-universe="true"
 #  EXIT="OK"
 
 [ "`echo -n "$RETPARAMS" | grep 'EXIT' | grep 'OK'`" = "" ] && exit
+
+#120529
+PREVFLG="`cat /var/local/petget/flg_appicons`"
+if [ "`echo -n "$RETPARAMS" | grep 'CHK_APPICONS' | grep 'true'`" != "" ];then
+ echo -n 'true' > /var/local/petget/flg_appicons
+ NEWFLG='true'
+else
+ echo -n 'false' > /var/local/petget/flg_appicons
+ NEWFLG='false'
+fi
+if [ "$PREVFLG" != "$NEWFLG" ];then
+ #rm -f /tmp/petget_fltrd_repo_*
+ #rm -f /tmp/petget_installed_*
+ rm -f /tmp/installedpkgs.results.post*
+ rm -f /tmp/petget/filterpkgs.results.post*
+fi
 
 enabledrepos=" "
 repocnt=1
 for ONEREPO in `ls -1 /root/.packages/Packages-*`
 do

Changes to woof-code/rootfs-skeleton/usr/local/petget/findnames.sh

@@ -10,10 +10,11 @@
 #120323 replace 'xmessage' with 'pupmessage'.
 #120410 Mavrothal: fix "getext" typo.
 #120504 Mavrothal: search with multiple keywords, both pkg name and description.
 #120504 some files moved into /tmp/petget
 #120515 common code from pkg_chooser.sh, findnames.sh, filterpkgs.sh, extracted to /usr/local/petget/postfilterpkgs.sh.
+#120529 fix if icon name appended each line.
 
 export TEXTDOMAIN=petget___findnames.sh
 export OUTPUT_CHARSET=UTF-8
 
 . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
@@ -124,18 +125,24 @@
 
  #120515 post-filter /tmp/petget/filterpkgs.results.post according to EXE,DEV,DOC,NLS checkboxes...
  /usr/local/petget/postfilterpkgs.sh
  #...main gui will read /tmp/petget/filterpkgs.results.post (actually that happens in ui_Classic or ui_Ziggy, which is included in pkg_chooser.sh).
 
+ #120529 hiccup, filterpkgs.results.post may now have icon name appended each line, but filterpkgs.results.post-noicons is backup (created by postfilterpkgs.sh)
  #120504 post-process presentation to show which repo...
  #filterpkgs.results.post each line has package-name|description|repo-triad
  #when we have searched multiple repos, move repo-triad into description field, so that it will show up on main window...
  if [ "$SEARCH_REPOS_FLAG" = "all" ];then
   #creates descript field like: "[puppy-4-official] Abiword word processor"
   #note, printcols (see support/printcols.c in Woof) needs a '|' on the end to work.
-  POSTPROCLIST="`printcols /tmp/petget/filterpkgs.results.post 1 3 2 3 | sed -e 's%|%FIRSTBARCHAR[%' -e 's%|%] %' -e 's%FIRSTBARCHAR%|%'`"
+  FLG_APPICONS="`cat /var/local/petget/flg_appicons`"
+  if [ "$FLG_APPICONS" = "true" ];then
+   POSTPROCLIST="`printcols /tmp/petget/filterpkgs.results.post 1 2 4 3 4 | sed -e 's%|%FIRSTBARCHAR%' -e 's%|%SECBARCHAR[%' -e 's%|%] %' -e 's%FIRSTBARCHAR%|%' -e 's%SECBARCHAR%|%'`"
+  else
+   POSTPROCLIST="`printcols /tmp/petget/filterpkgs.results.post 1 3 2 3 | sed -e 's%|%FIRSTBARCHAR[%' -e 's%|%] %' -e 's%FIRSTBARCHAR%|%'`"
+  fi
   echo "$POSTPROCLIST" > /tmp/petget/filterpkgs.results.post
   #ex line: abiword-1.2.3|[puppy-4-official] Abiword word processor|puppy-4-official|
  fi
 
 fi
 

Changes to woof-code/rootfs-skeleton/usr/local/petget/finduserinstalledpkgs.sh

@@ -1,13 +1,23 @@
 #!/bin/sh
 #(c) Copyright Barry Kauler 2009, puppylinux.com
 #2009 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html).
-#called from /usr/local/petget/pkg_chooser.sh
+#called from /usr/local/petget/pkg_chooser.sh (actually, from ui_Classic and ui_Ziggy, which are embedded in pkg_chooser.sh)
 #find all pkgs that have been user-installed, format for display.
 
 
 #/root/.packages/usr-installed-packages has the list of installed pkgs...
 touch /root/.packages/user-installed-packages
-cut -f 1,10 -d '|' /root/.packages/user-installed-packages > /tmp/installedpkgs.results
+cut -f 1,10 -d '|' /root/.packages/user-installed-packages > /tmp/petget/installedpkgs.results
 
+#120529 may have app icons displayed in main window...
+cp -f /tmp/petget/installedpkgs.results /tmp/petget/installedpkgs.results.post-noicons
+FLG_APPICONS="`cat /var/local/petget/flg_appicons`"
+if [ "$FLG_APPICONS" = "true" ];then
+ #note, for main tree, this is done in postfilterpkgs.sh.
+ #ex: 'abiword0-1.2.3|description of abiword|stuff' becomes 'abiword|abiword0-1.2.3|description of abiword|stuff'
+ sed -r -e 's%(^[a-zA-Z]*)%\1|\1%' /tmp/petget/installedpkgs.results > /tmp/petget/installedpkgs.results.post
+else
+ cp -f /tmp/petget/installedpkgs.results /tmp/petget/installedpkgs.results.post
+fi
 
 ###END###

Changes to woof-code/rootfs-skeleton/usr/local/petget/pkg_chooser.sh

@@ -18,10 +18,12 @@
 #120327 sometimes the selected repo radiobutton did not match listed packages at startup.
 #120504 /tmp/petget_filterversion renamed to /tmp/petget/current-repo-triad
 #120504 some files moved into /tmp/petget
 #120504b improved separation of dev,doc,nls,exe, enhanced ubuntu,debian pkg support.
 #120515 common code from pkg_chooser.sh, findnames.sh, filterpkgs.sh, extracted to /usr/local/petget/postfilterpkgs.sh.
+#120527 change gtkdialog3 to gtkdialog4. icon patterns for postfilterpkgs.sh.
+#120529 ui may show app thumbnail icons.
 
 export TEXTDOMAIN=petget___pkg_chooser.sh
 export OUTPUT_CHARSET=UTF-8
 
 [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
@@ -30,10 +32,27 @@
 mkdir -p /tmp/petget #120504
 
 . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
 . /root/.packages/DISTRO_PKGS_SPECS
 . /root/.packages/PKGS_MANAGEMENT #has PKG_REPOS_ENABLED, PKG_NAME_ALIASES
+
+#120527 need these patterns in postfilterpkgs.sh...
+#the awk stuff sorts the line by length of line, longer lines first. if only one char on line, append ^ ...
+#(fallback, any pkgs starting with 'k' are kde apps, or 'g' are gnome apps). also append '^' for 2-char lines...
+ICONPTNS="$(ls -1 /usr/share/icons/hicolor/16x16/apps | grep 'xpm$' | sed -e 's%\.xpm$%%' | awk '{print length, $0}' | sort -rn | awk '{$1=""; print $0 }' | sed -e 's%^ %%' | sed -r -e 's%(^[a-z][a-z]$)%^\1%' | sed -r -e 's%(^[a-z]$)%^\1%')"
+echo "$ICONPTNS" > /tmp/petget/postfilter_icon_ptns
+#echo -e 'perl\npython\ntcl\nmail\nkde\nqt\nQt\ndbus\ndb\n' >> /tmp/petget/postfilter_icon_ptns
+
+#120529 app icons
+if [ -f /var/local/petget/flg_appicons ];then
+ FLG_APPICONS="`cat /var/local/petget/flg_appicons`"
+else
+ #test if pet installed with set of 16x16 app icons...
+ [ "`grep 'icons_puppy_app' /root/.packages/woof-installed-packages /root/.packages/user-installed-packages`" != "" ] && FLG_APPICONS='true'
+fi
+[ "$FLG_APPICONS" = "" ] && FLG_APPICONS='false'
+echo -n "$FLG_APPICONS" > /var/local/petget/flg_appicons
 
 #101129 choose to display EXE, DEV, DOC, NLS pkgs... note, this code-block is also in findnames.sh and filterpkgs.sh...
 mkdir -p /var/local/petget
 DEF_CHK_EXE='true'
 DEF_CHK_DEV='false'
@@ -256,10 +275,10 @@
 UI="`cat /var/local/petget/ui_choice`"
 [ "$UI" = "" ] && UI="Classic"
 . /usr/local/petget/ui_${UI}
 
 
-RETPARAMS="`gtkdialog3 --program=MAIN_DIALOG`"
+RETPARAMS="`gtkdialog4 --program=MAIN_DIALOG`"
 
 #eval "$RETPARAMS"
 
 ###END###

Changes to woof-code/rootfs-skeleton/usr/local/petget/postfilterpkgs.sh

@@ -1,10 +1,11 @@
 #!/bin/sh
 #called from pkg_chooser.sh, findnames.sh, filterpkgs.sh
 #post-process the selection of pkgs that is to be displayed, according to the exe, dev, doc, nls checkboxes.
 #120515 script created, common code extracted from above 3 scripts.
 #120525 fix post-filtering.
+#120529 prefix an icon to each line of results.
 
 #ui_Ziggy and ui_Classic pass in two params, ex: EXE true
 [ $2 ] && echo -n "$2" > /var/local/petget/postfilter_${1}
 
 #101129 postprocess, show EXE, DEV, DOC, NLS...
@@ -29,7 +30,64 @@
 #120504b fix filtering out _EXE... 120515 must escape the dashes...
 if [ "$DEF_CHK_EXE" = "false" ];then
  grep -E '_DEV|_DOC|_NLS|\-dev_|\-doc_|\-docs_|\-langpack|\-lang\-|\-devel\-|\-doc\-' /tmp/petget/filterpkgs.results.post > /tmp/petget/filterpkgs.results.post.tmp
  mv -f /tmp/petget/filterpkgs.results.post.tmp /tmp/petget/filterpkgs.results.post
 fi
+
+#120529 append an icon to each entry...
+cp -f /tmp/petget/filterpkgs.results.post /tmp/petget/filterpkgs.results.post-noicons
+FLG_APPICONS="`cat /var/local/petget/flg_appicons`" #see configure.sh
+if [ "$FLG_APPICONS" = "true" ];then
+ #ex: 'abiword0-1.2.3|description of abiword|stuff' becomes 'abiword|abiword0-1.2.3|description of abiword|stuff'
+ sed -i -r -e 's%(^[a-zA-Z]*)%\1|\1%' /tmp/petget/filterpkgs.results.post
+fi
+exit
+
+#120529 ***NOT USING THIS*** used it to create all the icon symlinks.
+FRP="`cat /tmp/petget/filterpkgs.results.post`"
+echo -n "" > /tmp/petget/filterpkgs.results.post
+CACHEFLAG='no'
+while read ONELINE
+do
+ FIXED="$(echo "$ONELINE" | sed -r -e 's%(^[a-zA-Z]*)%\1|\1%')"
+ echo "$FIXED" >> /tmp/petget/filterpkgs.results.post
+ ICONNAME="${FIXED%%|*}"  #"$(echo -n "$FIXED" | cut -f 1 -d '|')"
+ if [ ! -e /usr/share/icons/hicolor/16x16/apps/${ICONNAME}.xpm ];then
+  CACHEFLAG='yes'
+  #this file is created in pkg_chooser.sh, has names of images that are in above 16x16/apps (sorted by size)...
+  #change 'cdbs_0.4.100ubuntu2|common build system for Debian packages|ubuntu-precise-main' to 'cdbs|common build system for Debian packages'...
+  ICONPTN="$(echo "$FIXED" | cut -f 1,3 -d '|' | grep -i -o -f /tmp/petget/postfilter_icon_ptns | head -n 1 | tr '[A-Z]' '[a-z]')"
+  #search all of pkg name, but screen out 'ubuntu' 'debian'...
+  [ "$ICONPTN" = "" ] && ICONPTN="$(echo "$FIXED" | cut -f 2 -d '|' | sed -e 's%ubuntu%%' -e 's%debian%%' | grep -i -o -f /tmp/petget/postfilter_icon_ptns | head -n 1 | tr '[A-Z]' '[a-z]')"
+  if [ "$ICONPTN" ];then
+   ln -s ${ICONPTN}.xpm /usr/share/icons/hicolor/16x16/apps/${ICONNAME}.xpm
+  else
+   #ln -s executable.xpm /usr/share/icons/hicolor/16x16/apps/${ICONNAME}.xpm
+   #no, link to the current category...
+   CURRENTCATEGORY="`cat /tmp/petget_filtercategory`"
+   case $CURRENTCATEGORY in
+    Desktop) CURICON='xorg' ;;
+    System) CURICON='systemapp' ;;
+    Setup) CURICON='setupapp' ;;
+    Utility) CURICON='utilityapp' ;;
+    Filesystem) CURICON='fileapp' ;;
+    Graphic) CURICON='graphicapp' ;;
+    Document) CURICON='documentapp' ;;
+    Business) CURICON='calculateapp' ;;
+    Personal) CURICON='personalapp' ;;
+    Network) CURICON='networkapp' ;;
+    Internet) CURICON='internetapp' ;;
+    Multimedia) CURICON='multimediaapp' ;;
+    Fun) CURICON='gameapp' ;;
+    *) CURICON='executable' ;;
+   esac
+   ln -s ${CURICON}.xpm /usr/share/icons/hicolor/16x16/apps/${ICONNAME}.xpm
+   #fPTN="s%^${ICONNAME}|%${CURICON}|%"
+   #sed -i -e "$fPTN" /tmp/petget/filterpkgs.results.post
+  fi
+ fi
+done<<_END1
+$(echo "$FRP")
+_END1
+[ "$CACHEFLAG" = "yes" ] && gtk-update-icon-cache -f /usr/share/icons/hicolor
 
 ###END###

Changes to woof-code/rootfs-skeleton/usr/local/petget/ui_Classic

@@ -1,13 +1,22 @@
 #default user interface.
 #120203 rodin.s: internationalized.
 #120224 handle translated help.htm
 #120504 some files moved into /tmp/petget
 #120515 calls to /tmp/petget/filterpkgs.results.postfilter.sh replace by /usr/local/petget/postfilterpkgs.sh.
+#120527 first column of tree now an icon.
+#120529 app icons in tree. variable FLG_APPICONS created in pkg_chooser.sh
 
 export TEXTDOMAIN=petget___ui_Classic
 export OUTPUT_CHARSET=UTF-8
+
+#120529
+if [ "$FLG_APPICONS" = "true" ];then
+ APPICONXMLINSERT=' icon-column="0"'
+else
+ APPICONXMLINSERT=''
+fi
 
 #120224 handle translated help.htm
 LANG1="${LANG%_*}" #ex: de
 HELPFILE="/usr/local/petget/help.htm"
 [ -f /usr/local/petget/help-${LANG1}.htm ] && HELPFILE="/usr/local/petget/help-${LANG1}.htm"
@@ -40,11 +49,11 @@
   <vbox>
   <tree>
     <label>$(gettext 'Package|Description')</label>
     <height>280</height><width>668</width>
     <variable>TREE1</variable>
-    <input>cat /tmp/petget/filterpkgs.results.post</input>
+    <input${APPICONXMLINSERT}>cat /tmp/petget/filterpkgs.results.post</input>
     <action signal=\"button-release-event\">/usr/local/petget/installpreview.sh</action>
     <action signal=\"button-release-event\">/usr/local/petget/finduserinstalledpkgs.sh</action>
     <action signal=\"button-release-event\">refresh:TREE2</action>
   </tree>
   </vbox>
@@ -92,11 +101,11 @@
  <frame $(gettext 'Installed packages')>
   <tree>
     <label>$(gettext 'Package|Description')</label>
     <height>100</height><width>480</width>
     <variable>TREE2</variable>
-    <input>cat /tmp/installedpkgs.results</input>
+    <input${APPICONXMLINSERT}>cat /tmp/petget/installedpkgs.results.post</input>
     <action signal=\"button-release-event\">/usr/local/petget/removepreview.sh</action>
     <action signal=\"button-release-event\">/usr/local/petget/finduserinstalledpkgs.sh</action>
     <action signal=\"button-release-event\">refresh:TREE2</action>
   </tree>
  </frame>

Changes to woof-code/rootfs-skeleton/usr/local/petget/ui_Ziggy

@@ -4,10 +4,11 @@
 #120224 handle translated help.htm
 #120225 fix for translated categories.
 #120504 some files moved into /tmp/petget
 #120508 01micko: bugfix. ref: http://murga-linux.com/puppy/viewtopic.php?p=625843#625843
 #120515 calls to /tmp/petget/filterpkgs.results.postfilter.sh replace by /usr/local/petget/postfilterpkgs.sh.
+#120529 app icons in tree. variable FLG_APPICONS created in pkg_chooser.sh
 
 export TEXTDOMAIN=petget___ui_Ziggy
 export OUTPUT_CHARSET=UTF-8
 
 ALLITEM='' ; ALLSTOCK='' ; CATHEIGHT='100' ; WINHEIGHT='380'
@@ -14,10 +15,17 @@
 if [ "$ALLCATEGORY" != "" ];then
  ALLITEM="<item stock=\"gtk-ALL\">$(gettext 'ALL')</item>"
  ALLSTOCK='stock["gtk-ALL"] = {{ "pet24.png", *, *, *}}'
  CATHEIGHT='112'
  WINHEIGHT='388'
+fi
+
+#120529
+if [ "$FLG_APPICONS" = "true" ];then
+ APPICONXMLINSERT=' icon-column="0"'
+else
+ APPICONXMLINSERT=''
 fi
 
 #120224 handle translated help.htm
 LANG1="${LANG%_*}" #ex: de
 HELPFILE="/usr/local/petget/help.htm"
@@ -148,11 +156,11 @@
   </tree>
 </vbox>
   <tree>
     <label>$(gettext 'Package|Description')</label>
     <variable>TREE1</variable>
-    <input>cat /tmp/petget/filterpkgs.results.post</input>
+    <input${APPICONXMLINSERT}>cat /tmp/petget/filterpkgs.results.post</input>
     <action signal=\"button-release-event\">/usr/local/petget/installpreview.sh</action>
     <action signal=\"button-release-event\">/usr/local/petget/finduserinstalledpkgs.sh</action>
     <action signal=\"button-release-event\">refresh:TREE2</action>
   </tree>
 
@@ -163,11 +171,11 @@
  <vbox>
   <text><label>'$(gettext 'Click on an item in the list to uninstall package')'</label></text>
   <tree>
     <label>'$(gettext 'Installed Package|Description')'</label>
     <variable>TREE2</variable>
-    <input>cat /tmp/installedpkgs.results</input>
+    <input'${APPICONXMLINSERT}'>cat /tmp/petget/installedpkgs.results.post</input>
     <action signal="button-release-event">/usr/local/petget/removepreview.sh</action>
     <action signal="button-release-event">/usr/local/petget/finduserinstalledpkgs.sh</action>
     <action signal="button-release-event">refresh:TREE2</action>
   </tree>
   </vbox>