python/python3-pmw: Added (Python megawidgets).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
15cb94a8a9
commit
be036e72a5
|
@ -0,0 +1,3 @@
|
|||
Pmw is a toolkit for building high-level compound widgets in Python
|
||||
using the Tkinter module.
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
--- Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/example.orig.py 2024-01-16 20:29:10.976574813 +0200
|
||||
+++ Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/example.py 2024-01-16 20:31:31.276588327 +0200
|
||||
@@ -1,10 +1,10 @@
|
||||
-import tkinter
|
||||
+import tkinter
|
||||
import Pmw
|
||||
-
|
||||
+
|
||||
class ThresholdScale(Pmw.MegaWidget):
|
||||
""" Megawidget containing a scale and an indicator.
|
||||
"""
|
||||
-
|
||||
+
|
||||
def __init__(self, parent = None, **kw):
|
||||
|
||||
# Define the megawidget options.
|
||||
@@ -14,13 +14,13 @@
|
||||
('value', None, Pmw.INITOPT),
|
||||
)
|
||||
self.defineoptions(kw, optiondefs)
|
||||
-
|
||||
+
|
||||
# Initialise base class (after defining options).
|
||||
Pmw.MegaWidget.__init__(self, parent)
|
||||
-
|
||||
+
|
||||
# Create the components.
|
||||
interior = self.interior()
|
||||
-
|
||||
+
|
||||
# Create the indicator component.
|
||||
self.indicator = self.createcomponent('indicator',
|
||||
(), None,
|
||||
@@ -30,7 +30,7 @@
|
||||
borderwidth = 2,
|
||||
relief = 'raised')
|
||||
self.indicator.grid()
|
||||
-
|
||||
+
|
||||
# Create the scale component.
|
||||
self.scale = self.createcomponent('scale',
|
||||
(), None,
|
||||
@@ -42,23 +42,23 @@
|
||||
to = 0,
|
||||
showvalue = 0)
|
||||
self.scale.grid()
|
||||
-
|
||||
+
|
||||
value = self['value']
|
||||
if value is not None:
|
||||
self.scale.set(value)
|
||||
-
|
||||
+
|
||||
# Check keywords and initialise options.
|
||||
self.initialiseoptions()
|
||||
|
||||
def _doCommand(self, valueStr):
|
||||
- if self.scale.get() > self['threshold']:
|
||||
- color = self['colors'][1]
|
||||
- else:
|
||||
- color = self['colors'][0]
|
||||
- self.indicator.configure(background = color)
|
||||
+ if self.scale.get() > self['threshold']:
|
||||
+ color = self['colors'][1]
|
||||
+ else:
|
||||
+ color = self['colors'][0]
|
||||
+ self.indicator.configure(background = color)
|
||||
|
||||
Pmw.forwardmethods(ThresholdScale, tkinter.Scale, 'scale')
|
||||
-
|
||||
+
|
||||
# Initialise tkinter and Pmw.
|
||||
root = Pmw.initialise()
|
||||
root.title('Pmw ThresholdScale demonstration')
|
|
@ -0,0 +1,154 @@
|
|||
--- Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/exercises.orig.py 2024-01-16 20:29:25.109576174 +0200
|
||||
+++ Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/exercises.py 2024-01-16 20:41:17.246644768 +0200
|
||||
@@ -1,10 +1,10 @@
|
||||
-import tkinter
|
||||
+import tkinter
|
||||
import Pmw
|
||||
-
|
||||
+
|
||||
class ThresholdScale(Pmw.MegaWidget):
|
||||
""" Megawidget containing a scale and an indicator.
|
||||
"""
|
||||
-
|
||||
+
|
||||
def __init__(self, parent = None, **kw):
|
||||
# Define the megawidget options.
|
||||
optiondefs = (
|
||||
@@ -16,13 +16,13 @@
|
||||
('value', None, Pmw.INITOPT),
|
||||
)
|
||||
self.defineoptions(kw, optiondefs)
|
||||
-
|
||||
+
|
||||
# Initialise base class (after defining options).
|
||||
Pmw.MegaWidget.__init__(self, parent)
|
||||
-
|
||||
+
|
||||
# Create the components.
|
||||
interior = self.interior()
|
||||
-
|
||||
+
|
||||
# Create the indicator component.
|
||||
self.indicator = self.createcomponent('indicator',
|
||||
(), None,
|
||||
@@ -31,69 +31,69 @@
|
||||
height = 16,
|
||||
borderwidth = 2,
|
||||
relief = 'raised')
|
||||
-
|
||||
+
|
||||
# Create the value component.
|
||||
self.value = self.createcomponent('value',
|
||||
(), None,
|
||||
tkinter.Label, interior,
|
||||
width = 3)
|
||||
-
|
||||
+
|
||||
# Create the scale component.
|
||||
- if self['orient'] == 'vertical':
|
||||
- # The default scale range seems to be
|
||||
- # the wrong way around - reverse it.
|
||||
- from_ = 100
|
||||
- to = 0
|
||||
- else:
|
||||
- from_ = 0
|
||||
- to = 100
|
||||
+ if self['orient'] == 'vertical':
|
||||
+ # The default scale range seems to be
|
||||
+ # the wrong way around - reverse it.
|
||||
+ from_ = 100
|
||||
+ to = 0
|
||||
+ else:
|
||||
+ from_ = 0
|
||||
+ to = 100
|
||||
|
||||
- self.scale = self.createcomponent('scale',
|
||||
- (), None,
|
||||
- tkinter.Scale, interior,
|
||||
- orient = self['orient'],
|
||||
- command = self._doCommand,
|
||||
- tickinterval = 20,
|
||||
- length = 200,
|
||||
- from_ = from_,
|
||||
- to = to,
|
||||
- showvalue = 0)
|
||||
-
|
||||
- value = self['value']
|
||||
- if value is not None:
|
||||
- self.scale.set(value)
|
||||
-
|
||||
- # Use grid to position all components
|
||||
- if self['orient'] == 'vertical':
|
||||
- self.indicator.grid(row = 1, column = 1)
|
||||
- self.value.grid(row = 2, column = 1)
|
||||
- self.scale.grid(row = 3, column = 1)
|
||||
- # Create the label.
|
||||
- self.createlabel(interior, childRows=3)
|
||||
- else:
|
||||
- self.indicator.grid(row = 1, column = 1)
|
||||
- self.value.grid(row = 1, column = 2)
|
||||
- self.scale.grid(row = 1, column = 3)
|
||||
- # Create the label.
|
||||
- self.createlabel(interior, childCols=3)
|
||||
+ self.scale = self.createcomponent('scale',
|
||||
+ (), None,
|
||||
+ tkinter.Scale, interior,
|
||||
+ orient = self['orient'],
|
||||
+ command = self._doCommand,
|
||||
+ tickinterval = 20,
|
||||
+ length = 200,
|
||||
+ from_ = from_,
|
||||
+ to = to,
|
||||
+ showvalue = 0)
|
||||
+
|
||||
+ value = self['value']
|
||||
+ if value is not None:
|
||||
+ self.scale.set(value)
|
||||
|
||||
- # Check keywords and initialise options.
|
||||
- self.initialiseoptions()
|
||||
+ # Use grid to position all components
|
||||
+ if self['orient'] == 'vertical':
|
||||
+ self.indicator.grid(row = 1, column = 1)
|
||||
+ self.value.grid(row = 2, column = 1)
|
||||
+ self.scale.grid(row = 3, column = 1)
|
||||
+ # Create the label.
|
||||
+ self.createlabel(interior, childRows=3)
|
||||
+ else:
|
||||
+ self.indicator.grid(row = 1, column = 1)
|
||||
+ self.value.grid(row = 1, column = 2)
|
||||
+ self.scale.grid(row = 1, column = 3)
|
||||
+ # Create the label.
|
||||
+ self.createlabel(interior, childCols=3)
|
||||
+
|
||||
+ # Check keywords and initialise options.
|
||||
+ self.initialiseoptions()
|
||||
|
||||
def _doCommand(self, valueStr):
|
||||
- valueInt = self.scale.get()
|
||||
- colors = self['colors']
|
||||
- thresholds = self['threshold']
|
||||
- color = colors[-1]
|
||||
- for index in range(len(colors) - 1):
|
||||
- if valueInt <= thresholds[index]:
|
||||
- color = colors[index]
|
||||
- break
|
||||
- self.indicator.configure(background = color)
|
||||
- self.value.configure(text = valueStr)
|
||||
+ valueInt = self.scale.get()
|
||||
+ colors = self['colors']
|
||||
+ thresholds = self['threshold']
|
||||
+ color = colors[-1]
|
||||
+ for index in range(len(colors) - 1):
|
||||
+ if valueInt <= thresholds[index]:
|
||||
+ color = colors[index]
|
||||
+ break
|
||||
+ self.indicator.configure(background = color)
|
||||
+ self.value.configure(text = valueStr)
|
||||
|
||||
Pmw.forwardmethods(ThresholdScale, tkinter.Scale, 'scale')
|
||||
-
|
||||
+
|
||||
# Initialise tkinter and Pmw.
|
||||
root = Pmw.initialise()
|
||||
root.title('Pmw ThresholdScale demonstration')
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for python3-pmw
|
||||
|
||||
# Copyright 2024 Dimitris Zlatanidis Greece, Orestiada
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=python3-pmw
|
||||
SRCNAM=Pmw
|
||||
VERSION=${VERSION:-2.1.1}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $SRCNAM-$VERSION
|
||||
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
|
||||
cd $SRCNAM-$VERSION
|
||||
chown -R root:root .
|
||||
find -L . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
||||
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# Fix IndentationError
|
||||
patch -p1 < $CWD/examples.patch
|
||||
patch -p1 < $CWD/exercises.patch
|
||||
|
||||
python3 setup.py install --root=$PKG
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a PKG-INFO $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="python3-pmw"
|
||||
VERSION="2.1.1"
|
||||
HOMEPAGE="http://pmw.sourceforge.net"
|
||||
DOWNLOAD="https://files.pythonhosted.org/packages/78/c7/d2e18a08af53d64eb658c5ca9b4655317c3d3e54589fe86e3a3bf0b51762/Pmw-2.1.1.tar.gz"
|
||||
MD5SUM="8b816709e4f1d486ba47f1dc787066ee"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="Dimitris Zlatanidis"
|
||||
EMAIL="dslackw@gmail.com"
|
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
python3-pmw: python3-pmw (Python megawidgets)
|
||||
python3-pmw:
|
||||
python3-pmw: Pmw is a toolkit for building high-level compound widgets in Python
|
||||
python3-pmw: using the Tkinter module.
|
||||
python3-pmw:
|
||||
python3-pmw: Homepage: https://pmw.sourceforge.net
|
||||
python3-pmw:
|
||||
python3-pmw:
|
||||
python3-pmw:
|
||||
python3-pmw:
|
||||
python3-pmw:
|
Loading…
Reference in New Issue