Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
## [Unreleased]
## [v0.7.5]

## Added

1. Add day separator before the first message of a day.
2. Add a jump / navigate to date floating window triggered with:
- a shortcut: Ctrl+Shift+F.
- a toobar button
3. Add context menu to chat view for copying message text.


## Changed

1. Set single step scrolling for smoother scrolling.

---

## [v0.7.0]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pip install git+https://github.com/shsiddhant/memory.text.git

### Filter and Search

- [x] Copy message text
- [ ] Search messages
- [ ] Filter by participants
- [ ] Sort/filter by timestamps
Expand Down
23 changes: 21 additions & 2 deletions src/memorytext/views/chat_view.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from PySide6.QtWidgets import QListView
from PySide6.QtWidgets import QApplication, QListView, QMenu
from PySide6.QtCore import Qt
from PySide6.QtGui import QFont
from PySide6.QtGui import QAction, QFont, QIcon

from memorytext.models.message_list import MessageList
from memorytext.services import message_service
Expand All @@ -13,6 +13,9 @@
import datetime


COPY_ICON = QIcon.fromTheme("edit-copy")


class ChatView(QListView):
def __init__(self):
super().__init__()
Expand All @@ -27,6 +30,10 @@ def __init__(self):
self.setItemDelegate(self.delegate)
self.setWordWrap(True)
self.setUniformItemSizes(False)
self.setMouseTracking(True)
self.setAttribute(Qt.WidgetAttribute.WA_Hover)
self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context_menu)
self.setFocusPolicy(Qt.NoFocus) # pyright: ignore[reportAttributeAccessIssue]

def set_messages(
Expand All @@ -49,3 +56,15 @@ def jump_to_date(self, date: datetime.date):
if target_index:
self.scrollTo(target_index, self.ScrollHint.PositionAtTop)
self.setCurrentIndex(target_index)

def show_context_menu(self, position):
index = self.indexAt(position)
if index.isValid():
menu = QMenu(self)
copy_action = QAction(COPY_ICON, "Copy Message", self)
menu.addAction(copy_action)
action = menu.exec(self.viewport().mapToGlobal(position))
if action == copy_action:
QApplication.clipboard().setText(
index.data(Qt.ItemDataRole.DisplayRole)
)
1 change: 1 addition & 0 deletions src/memorytext/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self):

# Messages
self.chat_area = ChatView()
self.chat_area.verticalScrollBar().setSingleStep(5) # Smoother Scrolling
main_layout.addLayout(sidebar_layout, stretch=1)
main_layout.addWidget(self.chat_area, stretch=2)
self.sidebar.clicked.connect(self.load_messages)
Expand Down
Loading