GRAYBYTE WORDPRESS FILE MANAGER7809

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
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 : /usr/lib64/python2.7/site-packages/pynche/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


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

The TextViewer allows you to see how the selected color would affect various
characteristics of a Tk text widget.  This is an output viewer only.

In the top part of the window is a standard text widget with some sample text
in it.  You are free to edit this text in any way you want (BAW: allow you to
change font characteristics).  If you want changes in other viewers to update
text characteristics, turn on Track color changes.

To select which characteristic tracks the change, select one of the radio
buttons in the window below.  Text foreground and background affect the text
in the window above.  The Selection is what you see when you click the middle
button and drag it through some text.  The Insertion is the insertion cursor
in the text window (which only has a background).
"""

from Tkinter import *
import ColorDB

ADDTOVIEW = 'Text Window...'



class TextViewer:
    def __init__(self, switchboard, master=None):
        self.__sb = switchboard
        optiondb = switchboard.optiondb()
        root = self.__root = Toplevel(master, class_='Pynche')
        root.protocol('WM_DELETE_WINDOW', self.withdraw)
        root.title('Pynche Text Window')
        root.iconname('Pynche Text Window')
        root.bind('<Alt-q>', self.__quit)
        root.bind('<Alt-Q>', self.__quit)
        root.bind('<Alt-w>', self.withdraw)
        root.bind('<Alt-W>', self.withdraw)
        #
        # create the text widget
        #
        self.__text = Text(root, relief=SUNKEN,
                           background=optiondb.get('TEXTBG', 'black'),
                           foreground=optiondb.get('TEXTFG', 'white'),
                           width=35, height=15)
        sfg = optiondb.get('TEXT_SFG')
        if sfg:
            self.__text.configure(selectforeground=sfg)
        sbg = optiondb.get('TEXT_SBG')
        if sbg:
            self.__text.configure(selectbackground=sbg)
        ibg = optiondb.get('TEXT_IBG')
        if ibg:
            self.__text.configure(insertbackground=ibg)
        self.__text.pack()
        self.__text.insert(0.0, optiondb.get('TEXT', '''\
Insert some stuff here and play
with the buttons below to see
how the colors interact in
textual displays.

See how the selection can also
be affected by tickling the buttons
and choosing a color.'''))
        insert = optiondb.get('TEXTINS')
        if insert:
            self.__text.mark_set(INSERT, insert)
        try:
            start, end = optiondb.get('TEXTSEL', (6.0, END))
            self.__text.tag_add(SEL, start, end)
        except ValueError:
            # selection wasn't set
            pass
        self.__text.focus_set()
        #
        # variables
        self.__trackp = BooleanVar()
        self.__trackp.set(optiondb.get('TRACKP', 0))
        self.__which = IntVar()
        self.__which.set(optiondb.get('WHICH', 0))
        #
        # track toggle
        self.__t = Checkbutton(root, text='Track color changes',
                               variable=self.__trackp,
                               relief=GROOVE,
                               command=self.__toggletrack)
        self.__t.pack(fill=X, expand=YES)
        frame = self.__frame = Frame(root)
        frame.pack()
        #
        # labels
        self.__labels = []
        row = 2
        for text in ('Text:', 'Selection:', 'Insertion:'):
            l = Label(frame, text=text)
            l.grid(row=row, column=0, sticky=E)
            self.__labels.append(l)
            row += 1
        col = 1
        for text in ('Foreground', 'Background'):
            l = Label(frame, text=text)
            l.grid(row=1, column=col)
            self.__labels.append(l)
            col += 1
        #
        # radios
        self.__radios = []
        for col in (1, 2):
            for row in (2, 3, 4):
                # there is no insertforeground option
                if row==4 and col==1:
                    continue
                r = Radiobutton(frame, variable=self.__which,
                                value=(row-2)*2 + col-1,
                                command=self.__set_color)
                r.grid(row=row, column=col)
                self.__radios.append(r)
        self.__toggletrack()

    def __quit(self, event=None):
        self.__root.quit()

    def withdraw(self, event=None):
        self.__root.withdraw()

    def deiconify(self, event=None):
        self.__root.deiconify()

    def __forceupdate(self, event=None):
        self.__sb.update_views_current()

    def __toggletrack(self, event=None):
        if self.__trackp.get():
            state = NORMAL
            fg = self.__radios[0]['foreground']
        else:
            state = DISABLED
            fg = self.__radios[0]['disabledforeground']
        for r in self.__radios:
            r.configure(state=state)
        for l in self.__labels:
            l.configure(foreground=fg)

    def __set_color(self, event=None):
        which = self.__which.get()
        text = self.__text
        if which == 0:
            color = text['foreground']
        elif which == 1:
            color = text['background']
        elif which == 2:
            color = text['selectforeground']
        elif which == 3:
            color = text['selectbackground']
        elif which == 5:
            color = text['insertbackground']
        try:
            red, green, blue = ColorDB.rrggbb_to_triplet(color)
        except ColorDB.BadColor:
            # must have been a color name
            red, green, blue = self.__sb.colordb().find_byname(color)
        self.__sb.update_views(red, green, blue)

    def update_yourself(self, red, green, blue):
        if self.__trackp.get():
            colorname = ColorDB.triplet_to_rrggbb((red, green, blue))
            which = self.__which.get()
            text = self.__text
            if which == 0:
                text.configure(foreground=colorname)
            elif which == 1:
                text.configure(background=colorname)
            elif which == 2:
                text.configure(selectforeground=colorname)
            elif which == 3:
                text.configure(selectbackground=colorname)
            elif which == 5:
                text.configure(insertbackground=colorname)

    def save_options(self, optiondb):
        optiondb['TRACKP'] = self.__trackp.get()
        optiondb['WHICH'] = self.__which.get()
        optiondb['TEXT'] = self.__text.get(0.0, 'end - 1c')
        optiondb['TEXTSEL'] = self.__text.tag_ranges(SEL)[0:2]
        optiondb['TEXTINS'] = self.__text.index(INSERT)
        optiondb['TEXTFG'] = self.__text['foreground']
        optiondb['TEXTBG'] = self.__text['background']
        optiondb['TEXT_SFG'] = self.__text['selectforeground']
        optiondb['TEXT_SBG'] = self.__text['selectbackground']
        optiondb['TEXT_IBG'] = self.__text['insertbackground']

[ 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