Example #1
0
 def __init__(self, master, **opts):
     if 'handlers' in opts:
         self.handlers = opts.pop('handlers')
     else:
         self.handlers = {}
     opts['font'] = gui.fontNormal
     defaults = self.getDefaults()
     defaults.update(opts)
     Scrollable.__init__(self, master, tk.Text, wrap=tk.WORD, **opts)
     self._createWidgets(master, **defaults)
     self.configureTags()
Example #2
0
 def __init__(self, master, **opts):
     if 'handlers' in opts:
         self.handlers = opts.pop('handlers')
     else:
         self.handlers = {}
     opts['font'] = gui.fontNormal
     defaults = self.getDefaults()
     defaults.update(opts)
     Scrollable.__init__(self, master, tk.Text, wrap=tk.WORD, **opts)
     self._createWidgets(master, **defaults)
     self.configureTags()
Example #3
0
    def __init__(self,
                 parent,
                 tooltipCallback=None,
                 tooltipDelay=1500,
                 **kwargs):
        defaults = {'bg': 'white'}
        defaults.update(kwargs)
        Scrollable.__init__(self, parent, tk.Canvas, **defaults)

        self.lastItem = None  # Track last item selected
        self.lastPos = (0, 0)  # Track last clicked position
        self.firstPos = None  # Track first clicked position (for a drag action)
        self.items = {}  # Keep a dictionary with high-level items
        self.cleanSelected = True

        self.onClickCallback = None
        self.onDoubleClickCallback = None
        self.onRightClickCallback = None
        self.onControlClickCallback = None
        self.onAreaSelected = None

        # Add bindings
        self.bind("<Button-1>", self.onClick)
        self.bind("<ButtonRelease-1>", self.onButton1Release)
        self.bind("<Button-3>", self.onRightClick)
        self.bind("<Double-Button-1>", self.onDoubleClick)
        self.bind("<B1-Motion>", self.onDrag)
        # Hide the right-click menu
        self.bind('<FocusOut>', self._unpostMenu)
        self.bind("<Key>", self._unpostMenu)
        self.bind("<Control-1>", self.onControlClick)
        #self.bind("<MouseWheel>", self.onScroll)
        # Scroll bindings in Linux
        self.bind("<Shift-Button-4>", self.zoomerP)
        self.bind("<Shift-Button-5>", self.zoomerM)

        self._tooltipId = None
        self._tooltipOn = False  # True if the tooltip is displayed
        self._tooltipCallback = tooltipCallback
        self._tooltipDelay = tooltipDelay

        self._runsFont = tkFont.Font(family='sans-serif',
                                     size=DEFAULT_FONT_SIZE)
        self._zoomFactor = DEFAULT_ZOOM

        if tooltipCallback:
            self.bind('<Motion>', self.onMotion)
            #self.bind('<Leave>', self.onLeave)
            self._createTooltip()  # This should set

        self._menu = tk.Menu(self, tearoff=0)
Example #4
0
    def __init__(self, parent, tooltipCallback=None, tooltipDelay=1500, **kwargs):
        defaults = {'bg': 'white'}
        defaults.update(kwargs)
        Scrollable.__init__(self, parent, tk.Canvas, **defaults)
        
        self.lastItem = None # Track last item selected
        self.lastPos = (0, 0) # Track last clicked position
        self.eventPos = (0, 0)
        self.firstPos = None  # Track first clicked position (for a drag action)
        self.items = {} # Keep a dictionary with high-level items
        self.cleanSelected = True
        
        self.onClickCallback = None
        self.onDoubleClickCallback = None
        self.onRightClickCallback = None
        self.onControlClickCallback = None
        self.onAreaSelected = None
        
        # Add bindings
        self.bind("<Button-1>", self.onClick)
        self.bind("<ButtonRelease-1>", self.onButton1Release)
        self.bind("<Button-3>", self.onRightClick)
        self.bind("<Double-Button-1>", self.onDoubleClick)
        self.bind("<B1-Motion>", self.onDrag)
        # Hide the right-click menu
        self.bind('<FocusOut>', self._unpostMenu)
        self.bind("<Key>", self._unpostMenu)
        self.bind("<Control-1>", self.onControlClick)
        #self.bind("<MouseWheel>", self.onScroll)
        # Scroll bindings in Linux
        self.bind("<Shift-Button-4>", self.zoomerP)
        self.bind("<Shift-Button-5>", self.zoomerM)
        
        self._tooltipId = None
        self._tooltipOn = False  # True if the tooltip is displayed
        self._tooltipCallback = tooltipCallback
        self._tooltipDelay = tooltipDelay

        self._runsFont = tkFont.Font(family='sans-serif', size=DEFAULT_FONT_SIZE)
        self._zoomFactor = DEFAULT_ZOOM
        
        if tooltipCallback:
            self.bind('<Motion>', self.onMotion)
            #self.bind('<Leave>', self.onLeave)
            self._createTooltip() # This should set
        
        self._menu = tk.Menu(self, tearoff=0)
Example #5
0
 def __init__(self, parent, tooltipCallback=None, tooltipDelay=1500, **kwargs):
     defaults = {'bg': 'white'}
     defaults.update(kwargs)
     Scrollable.__init__(self, parent, tk.Canvas, **defaults)
     
     self.lastItem = None # Track last item selected
     self.lastPos = (0, 0) # Track last clicked position
     self.items = {} # Keep a dictionary with high-level items
     self.cleanSelected = True
     
     self.onClickCallback = None
     self.onDoubleClickCallback = None
     self.onRightClickCallback = None
     self.onControlClickCallback = None
     
     # Add bindings
     self.bind("<Button-1>", self.onClick)
     self.bind("<Button-3>", self.onRightClick)
     self.bind("<Double-Button-1>", self.onDoubleClick)
     self.bind("<B1-Motion>", self.onDrag)
             # Hide the right-click menu
     self.bind('<FocusOut>', self._unpostMenu)
     self.bind("<Key>", self._unpostMenu)
     self.bind("<Control-1>", self.onControlClick)
     #self.bind("<MouseWheel>", self.onScroll)
     
     self._tooltipId = None
     self._tooltipOn = False # True if the tooltip is displayed
     self._tooltipCallback = tooltipCallback
     self._tooltipDelay = tooltipDelay
     
     if tooltipCallback:
         self.bind('<Motion>', self.onMotion)
         #self.bind('<Leave>', self.onLeave)
         self._createTooltip() # This should set
     
     self._menu = tk.Menu(self, tearoff=0)
Example #6
0
    def __init__(self):
        super().__init__()
        self.wait_visibility()

        # self.attributes('-fullscreen', True)
        self.state('zoomed')
        self.title('Dublicate finder')

        self.menubar = tkinter.Menu(self)
        # self.menubar.add_command(label = 'Index', command = self._clickedFrame(self._index))
        self.menubar.add_command(label='Select',
                                 command=self._clickedFrame(self._index))
        self.menubar.add_command(label='SauceNAO',
                                 command=self._clickedFrame(self._sauceNao))
        self.menubar.add_command(label='Trash',
                                 command=self._clickedFrame(self._trash))
        self.menubar.add_command(label='Settings', command=self._showSettings)
        # self.menubar.add_command(label = 'Quit', command = self.destroy)

        self.config(menu=self.menubar)

        sframe = Scrollable.Frame(self)
        sframe.pack(expand=True, fill=tkinter.BOTH)

        self._settingFrame = Setting.Frame(sframe,
                                           confirmcommand=self._checkSettings,
                                           cancelcommand=self._hideSettings)
        self._frame = tkinter.Frame(sframe)
        self._settingsShown = False
        self._onFrameDelete = None

        if Setting.Data.autostart:
            self._start()
        else:
            self._showSettings()

        self.mainloop()
Example #7
0
 def __init__(self, master, frame=True, **opts):
     """Create a new Tree, if frame=True, a container
     frame will be created and an scrollbar will be added"""
     Scrollable.__init__(self, master, ttk.Treeview, frame, **opts)
Example #8
0
 def __init__(self, master, frame=True, **opts):
     """Create a new Tree, if frame=True, a container
     frame will be created and an scrollbar will be added"""
     Scrollable.__init__(self, master, ttk.Treeview, frame, **opts)
Example #9
0
                if not self._after and key in Trash.Data._dict and key not in SauceNao.Data:
                    self._autoselect(self._deleteButton,
                                     Setting.Data.autoselect)

                frame.pack(fill=tkinter.BOTH)
            else:
                if self._duplicates:
                    self._duplicates = None
                    self._items = {
                        key: []
                        for key, value in SauceNao.Data if len(value) > 1
                    }

                if self.command:
                    self.command()


if __name__ == '__main__':
    import widgets.Scrollable as Scrollable

    root = tkinter.Tk()
    root.state('zoomed')
    root.wait_visibility()

    frame = Scrollable.Frame(root)
    frame.pack(expand=True, fill=tkinter.BOTH)

    Frame(frame, command=lambda: root.after_idle(root.destroy)).pack(
        expand=True, fill=tkinter.BOTH)

    root.mainloop()