GRAYBYTE WORDPRESS FILE MANAGER1172

Server IP : 198.54.121.189 / Your IP : 216.73.216.34
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib64/python2.7/site-packages/pynche/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib64/python2.7/site-packages/pynche//TypeinViewer.py
"""TypeinViewer class.

The TypeinViewer is what you see at the lower right of the main Pynche
widget.  It contains three text entry fields, one each for red, green, blue.
Input into these windows is highly constrained; it only allows you to enter
values that are legal for a color axis.  This usually means 0-255 for decimal
input and 0x0 - 0xff for hex input.

You can toggle whether you want to view and input the values in either decimal
or hex by clicking on Hexadecimal.  By clicking on Update while typing, the
color selection will be made on every change to the text field.  Otherwise,
you must hit Return or Tab to select the color.
"""

from Tkinter import *



class TypeinViewer:
    def __init__(self, switchboard, master=None):
        # non-gui ivars
        self.__sb = switchboard
        optiondb = switchboard.optiondb()
        self.__hexp = BooleanVar()
        self.__hexp.set(optiondb.get('HEXTYPE', 0))
        self.__uwtyping = BooleanVar()
        self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
        # create the gui
        self.__frame = Frame(master, relief=RAISED, borderwidth=1)
        self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)
        self.__xox['font'] = 'courier'
        self.__x = Entry(subframe, width=3)
        self.__x.grid(row=0, column=1)
        self.__x.bindtags(self.__x.bindtags() + ('Normalize', 'Update'))
        self.__x.bind_class('Normalize', '<Key>', self.__normalize)
        self.__x.bind_class('Update'   , '<Key>', self.__maybeupdate)
        # Green
        self.__yl = Label(self.__frame, text='Green:')
        self.__yl.grid(row=1, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=1, column=1)
        self.__yox = Label(subframe, text='0x')
        self.__yox.grid(row=0, column=0, sticky=E)
        self.__yox['font'] = 'courier'
        self.__y = Entry(subframe, width=3)
        self.__y.grid(row=0, column=1)
        self.__y.bindtags(self.__y.bindtags() + ('Normalize', 'Update'))
        # Blue
        self.__zl = Label(self.__frame, text='Blue:')
        self.__zl.grid(row=2, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=2, column=1)
        self.__zox = Label(subframe, text='0x')
        self.__zox.grid(row=0, column=0, sticky=E)
        self.__zox['font'] = 'courier'
        self.__z = Entry(subframe, width=3)
        self.__z.grid(row=0, column=1)
        self.__z.bindtags(self.__z.bindtags() + ('Normalize', 'Update'))
        # Update while typing?
        self.__uwt = Checkbutton(self.__frame,
                                 text='Update while typing',
                                 variable=self.__uwtyping)
        self.__uwt.grid(row=3, column=0, columnspan=2, sticky=W)
        # Hex/Dec
        self.__hex = Checkbutton(self.__frame,
                                 text='Hexadecimal',
                                 variable=self.__hexp,
                                 command=self.__togglehex)
        self.__hex.grid(row=4, column=0, columnspan=2, sticky=W)

    def __togglehex(self, event=None):
        red, green, blue = self.__sb.current_rgb()
        if self.__hexp.get():
            label = '0x'
        else:
            label = '  '
        self.__xox['text'] = label
        self.__yox['text'] = label
        self.__zox['text'] = label
        self.update_yourself(red, green, blue)

    def __normalize(self, event=None):
        ew = event.widget
        contents = ew.get()
        icursor = ew.index(INSERT)
        if contents and contents[0] in 'xX' and self.__hexp.get():
            contents = '0' + contents
        # Figure out the contents in the current base.
        try:
            if self.__hexp.get():
                v = int(contents, 16)
            else:
                v = int(contents)
        except ValueError:
            v = None
        # If value is not legal, or empty, delete the last character inserted
        # and ring the bell.  Don't ring the bell if the field is empty (it'll
        # just equal zero.
        if v is None:
            pass
        elif v < 0 or v > 255:
            i = ew.index(INSERT)
            if event.char:
                contents = contents[:i-1] + contents[i:]
                icursor -= 1
            ew.bell()
        elif self.__hexp.get():
            contents = hex(v)[2:]
        else:
            contents = int(v)
        ew.delete(0, END)
        ew.insert(0, contents)
        ew.icursor(icursor)

    def __maybeupdate(self, event=None):
        if self.__uwtyping.get() or event.keysym in ('Return', 'Tab'):
            self.__update(event)

    def __update(self, event=None):
        redstr = self.__x.get() or '0'
        greenstr = self.__y.get() or '0'
        bluestr = self.__z.get() or '0'
        if self.__hexp.get():
            base = 16
        else:
            base = 10
        red, green, blue = [int(x, base) for x in (redstr, greenstr, bluestr)]
        self.__sb.update_views(red, green, blue)

    def update_yourself(self, red, green, blue):
        if self.__hexp.get():
            sred, sgreen, sblue = [hex(x)[2:] for x in (red, green, blue)]
        else:
            sred, sgreen, sblue = red, green, blue
        x, y, z = self.__x, self.__y, self.__z
        xicursor = x.index(INSERT)
        yicursor = y.index(INSERT)
        zicursor = z.index(INSERT)
        x.delete(0, END)
        y.delete(0, END)
        z.delete(0, END)
        x.insert(0, sred)
        y.insert(0, sgreen)
        z.insert(0, sblue)
        x.icursor(xicursor)
        y.icursor(yicursor)
        z.icursor(zicursor)

    def hexp_var(self):
        return self.__hexp

    def save_options(self, optiondb):
        optiondb['HEXTYPE'] = self.__hexp.get()
        optiondb['UPWHILETYPE'] = self.__uwtyping.get()

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 16 2025 08:59:53
root / root
0755
X
--
June 15 2024 08:34:37
root / root
0755
ChipViewer.py
4.881 KB
April 19 2020 21:13:39
root / root
0644
ChipViewer.pyc
5.37 KB
April 10 2024 04:58:44
root / root
0644
ChipViewer.pyo
5.37 KB
April 10 2024 04:58:44
root / root
0644
ColorDB.py
8.731 KB
April 19 2020 21:13:39
root / root
0644
ColorDB.pyc
9.465 KB
April 10 2024 04:58:44
root / root
0644
ColorDB.pyo
9.465 KB
April 10 2024 04:58:44
root / root
0644
DetailsViewer.py
9.879 KB
April 19 2020 21:13:39
root / root
0644
DetailsViewer.pyc
10.323 KB
April 10 2024 04:58:44
root / root
0644
DetailsViewer.pyo
10.323 KB
April 10 2024 04:58:44
root / root
0644
ListViewer.py
6.492 KB
April 19 2020 21:13:39
root / root
0644
ListViewer.pyc
7.025 KB
April 10 2024 04:58:44
root / root
0644
ListViewer.pyo
7.025 KB
April 10 2024 04:58:44
root / root
0644
Main.py
6.25 KB
April 19 2020 21:13:39
root / root
0644
Main.pyc
6.137 KB
April 10 2024 04:58:44
root / root
0644
Main.pyo
6.137 KB
April 10 2024 04:58:44
root / root
0644
PyncheWidget.py
10.255 KB
April 19 2020 21:13:39
root / root
0644
PyncheWidget.pyc
10.84 KB
April 10 2024 04:58:44
root / root
0644
PyncheWidget.pyo
10.84 KB
April 10 2024 04:58:44
root / root
0644
README
15.414 KB
April 19 2020 21:13:39
root / root
0644
StripViewer.py
15.103 KB
April 19 2020 21:13:39
root / root
0644
StripViewer.pyc
13.538 KB
April 10 2024 04:58:44
root / root
0644
StripViewer.pyo
13.396 KB
April 10 2024 04:58:42
root / root
0644
Switchboard.py
4.704 KB
April 19 2020 21:13:39
root / root
0644
Switchboard.pyc
5.923 KB
April 10 2024 04:58:44
root / root
0644
Switchboard.pyo
5.923 KB
April 10 2024 04:58:44
root / root
0644
TextViewer.py
6.708 KB
April 19 2020 21:13:39
root / root
0644
TextViewer.pyc
7.187 KB
April 10 2024 04:58:44
root / root
0644
TextViewer.pyo
7.187 KB
April 10 2024 04:58:44
root / root
0644
TypeinViewer.py
5.959 KB
April 19 2020 21:13:39
root / root
0644
TypeinViewer.pyc
6.261 KB
April 10 2024 04:58:44
root / root
0644
TypeinViewer.pyo
6.261 KB
April 10 2024 04:58:44
root / root
0644
__init__.py
0.046 KB
April 19 2020 21:13:39
root / root
0644
__init__.pyc
0.137 KB
April 10 2024 04:58:44
root / root
0644
__init__.pyo
0.137 KB
April 10 2024 04:58:44
root / root
0644
html40colors.txt
0.239 KB
April 19 2020 21:13:39
root / root
0644
namedcolors.txt
5.582 KB
April 19 2020 21:13:39
root / root
0644
pyColorChooser.py
3.68 KB
April 19 2020 21:13:39
root / root
0644
pyColorChooser.pyc
4.32 KB
April 10 2024 04:58:44
root / root
0644
pyColorChooser.pyo
4.32 KB
April 10 2024 04:58:44
root / root
0644
pynche
0.178 KB
April 10 2024 04:57:37
root / root
0755
webcolors.txt
3.016 KB
April 19 2020 21:13:39
root / root
0644
websafe.txt
1.708 KB
April 19 2020 21:13:39
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF