Skip to content

Commit

Permalink
Removed unrequired trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ceccopierangiolieugenio committed Jan 23, 2025
1 parent 4273b22 commit 7050c8f
Show file tree
Hide file tree
Showing 33 changed files with 130 additions and 130 deletions.
2 changes: 1 addition & 1 deletion TermTk/TTkAbstract/abstractscrollview.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def viewFullAreaSize(self) -> tuple[int,int]:
t,b,l,r = self.getPadding()
_,_,w,h = self.layout().fullWidgetAreaGeometry()
return w+l+r, h+t+b

@pyTTkSlot(int, int)
def viewMoveTo(self, x: int, y: int):
fw, fh = self.viewFullAreaSize()
Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkCore/TTkTerm/inputmouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, x: int, y: int, key: int, evt: int, mod: int, tap: int, raw:
self.mod = mod
self.raw = raw
self.tap = tap

def pos(self) -> tuple[int,int]:
'''
Returns the position of the mouse cursor relative to the current widget.
Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkCore/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def drawTTkString(self, pos, text, width=None, color=TTkColor.RST, alignment=TTk
self._data[y][x+a:x+b] = txt[a:b]
if forceColor:
colors=[color]*len(colors)
else:
else:
for i in range(a,b):
if color != TTkColor.RST:
self._colors[y][x+i] = (colors[i] | color).mod(x+i,y)
Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkCore/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _process_msg(mode: int, msg: str):
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe,1)
if len(calframe) > 2:
ctx = _TTkContext(calframe[2])
ctx = _TTkContext(calframe[2])
for txt in str(msg).split('\n'):
cb(mode, ctx, txt)

Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkCore/ttk.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import threading
import platform

from TermTk.TTkCore.drivers import *
from TermTk.TTkCore.drivers import TTkSignalDriver
from TermTk.TTkCore.TTkTerm.input import TTkInput
from TermTk.TTkCore.TTkTerm.inputkey import TTkKeyEvent
from TermTk.TTkCore.TTkTerm.inputmouse import TTkMouseEvent
Expand Down
12 changes: 6 additions & 6 deletions TermTk/TTkGui/drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ def data(self) -> Any:
:rtype: Any
'''
return self._data

def setHotSpot(self, pos:tuple[int,int]) -> None:
'''
Sets the position of the hot spot relative to the top-left corner of the pixmap used to the point specified by hotspot.
:param pos: the hotspot position
:type pos: tuple[int,int]
'''
'''
self._hotSpot = pos

def hotSpot(self) -> tuple[int,int]:
Expand All @@ -99,7 +99,7 @@ def hotSpot(self) -> tuple[int,int]:
:rtype: tuple[int,int]
'''
return self._hotSpot

class TTkDnDEvent(TTkDnD):
'''
Drag and Drop event class.
Expand All @@ -122,7 +122,7 @@ def pos(self) -> tuple[int,int]:
:rtype: tuple[int,int]
'''
return self._pos

class TTkDrag(TTkDnD):
__slots__ = ('_pixmap', '_showPixmap')
def __init__(self, **kwargs) -> None:
Expand Down Expand Up @@ -183,7 +183,7 @@ def exec(self) -> None:
Starts the drag operation.
'''
TTkHelper.dndInit(self)

def _toDropEvent(self, pos:tuple[int,int]) -> TTkDnDEvent:
ret = TTkDnDEvent(data=self._data, hotspot=self._hotSpot, pos=pos)
return ret
Expand Down Expand Up @@ -232,6 +232,6 @@ def getDropEvent(self, evt:TTkMouseEvent) -> TTkDnDEvent:
:type evt: :py:class:`TTkMouseEvent`
:return: The Drag and Drop event
:rtype: :py:class:`TTkDnDEvent`
:rtype: :py:class:`TTkDnDEvent`
'''
return self._toDropEvent((evt.x, evt.y))
4 changes: 2 additions & 2 deletions TermTk/TTkGui/textcursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def anchor(self) -> _CP:

def position(self) -> _CP:
return self._properties[self._cID].position

def cursors(self) -> list[_CP]:
return self._properties

Expand Down Expand Up @@ -601,7 +601,7 @@ def _getBlinkingCursors(self, fr:int, to:int, lines, color:TTkColor) -> list[TTk
if len(self._properties)>1:
for p in self._properties:
cp = p.position
if not 0<=(cp.line-fr)<len(ret): continue
if not 0<=(cp.line-fr)<len(ret): continue
ret[cp.line-fr] = ret[cp.line-fr].setColor(color=color+TTkColor.BLINKING, posFrom=cp.pos, posTo=cp.pos+1)
if cp.pos == len(ret[cp.line-fr]):
ret[cp.line-fr] = ret[cp.line-fr]+TTkString('↵',color+TTkColor.BLINKING)
Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkTestWidgets/testabstractscroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def paintEvent(self, canvas):

def mousePressEvent(self, evt:TTkMouseEvent) -> bool:
return True

def mouseReleaseEvent(self, evt:TTkMouseEvent) -> bool:
return True

Expand Down
6 changes: 3 additions & 3 deletions TermTk/TTkWidgets/combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
class _TTkComboBoxPopup(TTkResizableFrame):
classStyle = TTkResizableFrame.classStyle
classStyle['default'] |= {'searchColor': TTkColor.fg("#FFFF00")}

__slots__ = ('_list',
#exportedMethods
'setCurrentRow',
Expand All @@ -57,13 +57,13 @@ def __init__(self, *, items:list[str], **kwargs) -> None:

self.textClicked = self._list.textClicked
self.setCurrentRow = self._list.setCurrentRow

# def setFocus(self) -> None:
# self._list.viewport().setFocus()

def keyEvent(self, evt:TTkKeyEvent) -> bool:
return self._list.viewport().keyEvent(evt)

def paintEvent(self, canvas:TTkCanvas) -> None:
super().paintEvent(canvas)
if text := self._list.search():
Expand Down
28 changes: 14 additions & 14 deletions TermTk/TTkWidgets/listwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _setHighlighted(self, highlighted):
if self._highlighted == highlighted: return
self._highlighted = highlighted
self.update()

def geometry(self):
if self._quickVisible:
return super().geometry()
Expand All @@ -115,9 +115,9 @@ def paintEvent(self, canvas):
color = color+self.style()['selected']['color']
if style==self.style()['hover']:
color = color+self.style()['hover']['color']

w = self.width()

canvas.drawTTkString(pos=(0,0), width=w, color=color ,text=self._text)

class TTkListWidget(TTkAbstractScrollView):
Expand Down Expand Up @@ -256,14 +256,14 @@ def _labelSelectedHandler(self, label:TTkAbstractListItem):
self._highlighted = label
self.itemClicked.emit(label)
self.textClicked.emit(label.text())

@pyTTkSlot(str)
def _searchModifiedHandler(self, text:str='s') -> None:
if self._searchVisibility and self._searchText:
self.setPadding(1,0,0,0)
else:
self.setPadding(0,0,0,0)

if self._searchText:
text = self._searchText.lower()
self._filteredItems = [i for i in self._items if text in i._lowerText]
Expand All @@ -273,13 +273,13 @@ def _searchModifiedHandler(self, text:str='s') -> None:
self._filteredItems = self._items
for item in self._items:
item.setVisible(True)

self._placeItems()

def search(self) -> str:
'''search'''
return self._searchText

def setSearch(self, search:str) -> None:
'''setSearch'''
self._searchText = search
Expand All @@ -288,7 +288,7 @@ def setSearch(self, search:str) -> None:
def searchVisibility(self) -> bool:
'''searchVisibility'''
return self._searchVisibility

def setSearchVisibility(self, visibility:bool) -> None:
'''setSearchVisibility'''
self._searchVisibility = visibility
Expand Down Expand Up @@ -521,17 +521,17 @@ def keyEvent(self, evt:TTkKeyEvent) -> bool:
if self._highlighted:
# TTkLog.debug(self._highlighted)
self._highlighted.listItemClicked.emit(self._highlighted)

elif evt.type == TTkK.Character:
# Add this char to the search text
self._searchText += evt.key
self.update()
self.searchModified.emit(self._searchText)
elif ( evt.type == TTkK.SpecialKey and

elif ( evt.type == TTkK.SpecialKey and
evt.key == TTkK.Key_Tab ):
return False

elif ( evt.type == TTkK.SpecialKey and
evt.key in (TTkK.Key_Delete,TTkK.Key_Backspace) and
self._searchText ):
Expand Down Expand Up @@ -603,7 +603,7 @@ def paintChildCanvas(self):
p2 = (0,y-offy)
canvas.drawText(pos=p1,text="╙─╼", color=TTkColor.fg("#FFFF00")+TTkColor.bg("#008855"))
canvas.drawText(pos=p2,text="╓─╼", color=TTkColor.fg("#FFFF00")+TTkColor.bg("#008855"))

def paintEvent(self, canvas):
if self._searchVisibility and self._searchText:
w,h = self.size()
Expand Down
2 changes: 1 addition & 1 deletion TermTk/TTkWidgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def mouseEvent(self, evt:TTkMouseEvent) -> bool:
self.dragMoveEvent(TTkHelper.dndGetDrag().getDragMoveEvent(evt))
return True
else:
if ( self.dragEnterEvent(TTkHelper.dndGetDrag().getDragEnterEvent(evt)) or
if ( self.dragEnterEvent(TTkHelper.dndGetDrag().getDragEnterEvent(evt)) or
self.dragMoveEvent(TTkHelper.dndGetDrag().getDragMoveEvent(evt))):
if dndw:
ret = dndw.dragLeaveEvent(TTkHelper.dndGetDrag().getDragLeaveEvent(evt))
Expand Down
6 changes: 3 additions & 3 deletions docs/MDNotes/DumbPaintTool.TODO.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- [x] Save to open or last open/saved filename
- [ ] Ask to Save on quit
- [ ] Fix CanvasLayer Sizes on Save
- [ ] Fix CanvasLayer Sizes on Save
- [x] Brush colors applied back to Palette
- [x] Fix multiple layers added linked together
- AppTemplate
- AppTemplate
- [ ] Title, show the bar
- [ ] Add Title in the menuBar if available
- [ ] Tabs
- Tree
- [x] Expose resize
- [x] Expose resize
2 changes: 1 addition & 1 deletion docs/MDNotes/Fonts/Font2Glyph.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can use this command:

Check the font rendering in the browser:
https://typezebra.com
OK:
OK:
* FreeSans Regular
* FreeSerif Regular
* FreeMono Regular
Expand Down
2 changes: 1 addition & 1 deletion docs/MDNotes/input/abstracrt.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TTkInputDriver TTkInput T
yield inString --> for inString in _readInput.read()
kevt,mevt,paste = key_process(inString)
queue.put(kevt,mevt,paste)
queue.get()
inputEvent.emit(kevt, mevt) ------> _processInput
pasteEvent.emit(str) ------> _pasteInput
Expand Down
4 changes: 2 additions & 2 deletions docs/MDNotes/msWindows/Init Sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TTk:
- __init__()
```python
self._input = TTkInput()
self._input.inputEvent.connect(self._processInput)
self._input.inputEvent.connect(self._processInput)
self._input.pasteEvent.connect(self._processPaste)
```
- mainLoop()
Expand All @@ -15,7 +15,7 @@ TTk:
mouse=self._termMouse,
directMouse=self._termDirectMouse )
```

# How it Should Be
- __init__()
```python
Expand Down
2 changes: 1 addition & 1 deletion docs/MDNotes/terminal/escape.screen.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Gnu Screen Escape
Gnu Screen Escape
https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html

The following is a list of control sequences recognized by `screen`. ‘(V)’ and ‘(A)’ indicate VT100-specific and ANSI- or ISO-specific functions, respectively.
Expand Down
2 changes: 1 addition & 1 deletion docs/MDNotes/terminal/xterm.ctrlseq.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
https://www.x.org/docs/xterm/

# DCS - ESC P
ESC P + Pt + ESC \
ESC P + Pt + ESC \
Device Control String (DCS) xterm implements no DCS functions; Pt is ignored. Pt need not be printable characters.

vim initialization using DCS
Expand Down
28 changes: 14 additions & 14 deletions docs/source/info/resources/dragdrop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
Drag and Drop
=============

Drag and drop provides a simple visual mechanism which users can use to transfer
information between and within widgets.
Drag and drop provides a simple visual mechanism which users can use to transfer
information between and within widgets.
Drag and drop is similar in function to the clipboard's cut and paste mechanism.


.. image:: https://github.com/user-attachments/assets/857fd144-7a2a-4173-80b3-d135e62b8235


This document describes the basic drag and drop mechanism and outlines the
approach used to enable it in custom controls.
Drag and drop operations are also supported by many of TermTk's controls,
This document describes the basic drag and drop mechanism and outlines the
approach used to enable it in custom controls.
Drag and drop operations are also supported by many of TermTk's controls,
such as :py:class:`TTkList` or :py:class:`TTkTabWidget`.


Expand All @@ -38,10 +38,10 @@ These classes deal with drag and drop and the necessary mime type encoding and d
Dragging
--------

To start a drag, create a :py:class:`TTkDrag` object, and call its :py:meth:`TTkDrag.exec` function.
In most applications, it is a good idea to begin a drag and drop operation only
after a mouse button has been pressed and the cursor has been moved a certain distance.
However, the simplest way to enable dragging from a widget is to reimplement
To start a drag, create a :py:class:`TTkDrag` object, and call its :py:meth:`TTkDrag.exec` function.
In most applications, it is a good idea to begin a drag and drop operation only
after a mouse button has been pressed and the cursor has been moved a certain distance.
However, the simplest way to enable dragging from a widget is to reimplement
the widget's :py:meth:`TTkWidget.mouseDragEvent` and start a drag and drop operation:

.. code:: python
Expand All @@ -63,7 +63,7 @@ Note that the :py:meth:`TTkDrag.exec` function does not block the main event loo
Dropping
--------

To be able to receive the content dropped on a widget, reimplement
To be able to receive the content dropped on a widget, reimplement
the :py:meth:`TDragEvents.dropEvent` event handler functions.

.. code:: python
Expand Down Expand Up @@ -117,8 +117,8 @@ Pixmap
------

The visual representation of the drag can be customized by setting a pixmap with :py:meth:`TTkDrag.setPixmap`.
By default the pixmap is initialized as a simple text string ("[...]")
but it can be customized by using
By default the pixmap is initialized as a simple text string ("[...]")
but it can be customized by using
a :py:class:`TTkWidget` or :py:class:`TTkCanvas` as a pixmap.

.. image:: https://github.com/user-attachments/assets/7a23f5a9-444b-4e5a-878b-91c4b35ee8d8
Expand Down Expand Up @@ -175,8 +175,8 @@ HotSpot
-------

The hotspot is the offset of the pixmap related to the cursor position.
It can be set using :py:meth:`TTkDrag.setHotSpot`.
It is useful when the pixmap is not centered on the cursor or when you want to define an offset to allow
It can be set using :py:meth:`TTkDrag.setHotSpot`.
It is useful when the pixmap is not centered on the cursor or when you want to define an offset to allow
the object being dragged from the clicked position:

.. image:: https://github.com/user-attachments/assets/8d999365-c787-4eff-84f2-03ef2b22c37a
Expand Down
Loading

0 comments on commit 7050c8f

Please sign in to comment.