Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/220 Grab.app improvement #239

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fb4a6a1
Add dialogs and better ImageViewer
Jan 13, 2024
eb95dda
Update the Grab utility
Feb 10, 2024
f2658b8
Merge branch 'helloSystem:master' into FIX/220-Grab.appImprovevement
Hierosme Feb 10, 2024
6df63a1
Fixe Shift and many docs troubles
Feb 10, 2024
49a61ef
Try to hide window when tacking a screenshot
Feb 10, 2024
4e93a04
Selection work
Feb 11, 2024
fa8faa9
Create Window Grab and Selection Grab dialog
Feb 11, 2024
98da042
Fixe size
Feb 11, 2024
0104c00
Better is better
Feb 11, 2024
987e524
Better Title management and Selection work on multiscreen
Feb 12, 2024
81b9f74
Better Title management and Selection work on multiscreen
Feb 14, 2024
2ffdf44
Add sound from preference window
Feb 14, 2024
e953918
Coordinate position fixe and selection work on each direction
Feb 16, 2024
52889fc
Move selection coordinate into property_selection_area.py
Feb 16, 2024
a7c36d3
Use signal
Feb 16, 2024
0e03747
Restore visibility
Feb 16, 2024
d33da9b
It can draw cursor
Feb 16, 2024
bd072e8
Small clean up
Feb 20, 2024
52b2815
no numpy usage
Feb 20, 2024
75f0002
no numpy usage
Feb 20, 2024
bfeb015
Mini fixe for True hellosystem
Feb 20, 2024
875652d
Better dialog size optimisation
Feb 20, 2024
eb19d9f
Better dialog size optimisation take2
Feb 20, 2024
f6e6691
Have a Escape shortcut for each dialog
Feb 20, 2024
e6d6ebf
Better dialog button position
Feb 20, 2024
81a766f
Add spacing for icon on dialog
Feb 20, 2024
1799b08
Use super for focusOut event
Feb 20, 2024
7381e53
Use super for focusOut event
Feb 20, 2024
cbfe4c9
add timer
Feb 20, 2024
0ba936b
rename every preference cursor images
Feb 20, 2024
fe60032
Restore name for .ui import usage
Feb 20, 2024
57a8033
Restore name for .ui import usage
Feb 20, 2024
07b95f5
Better coord text loaction
Feb 29, 2024
665a1a6
Use application default font
Feb 29, 2024
232bf20
Fixe grab cursor
Feb 29, 2024
4213ed7
Merge branch 'helloSystem:master' into FIX/220-Grab.appImprovevement
Hierosme Jun 6, 2024
f08c272
Fixe QRect BreakOut
Jun 6, 2024
69ab0c0
Force a bit the ImageViewer to get back the focus
Jun 6, 2024
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
8 changes: 8 additions & 0 deletions Under Construction/Grab.app/Resources/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sound bank:

* Trigger of camera 1
* Title: Trigger camera SLR type (Nikon D70S). Standard noise.
* Author: Joseph SARDIN https://josephsardin.fr/
* Source: https://bigsoundbank.com/sound-2394-trigger-of-camera-1.html
* Right: https://bigsoundbank.com/right.html
619 changes: 619 additions & 0 deletions Under Construction/Grab.app/Resources/QtImageViewer.py

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions Under Construction/Grab.app/Resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Grab

Grab is an application that can capture screenshots of helloSystem and its applications. You tell Grab to capture what appears on your screen and it creates a PNG file. You can then view the PNG file with Preview or any application capable of opening PNGs.

## Create a screenshot
1. Set up the screen, so it shows what you want to capture.
2. Open the ``Grab`` icon in the Utilities folder or if ``Grab`` is already running, click its icon on the ``Dock`` to make it active.
3. Choose an option from the ``Capture`` menu or press its corresponding shortcut key:
* Selection ``(Shift+Ctrl+A)`` enable you to capture a portion of the screen. When you choose this option, the Selection Grab dialog appears. Use the mouse pointer to drag a box around the portion of the screen you want to capture . Release the mouse button to capture the screen.
* Window ``(Shift+Ctrl+W)`` enables you to capture a window. When you choose this option, the Window Grab dialog appears. Click the Choose Window button, then click the window you want to capture.
* Screen ``(Ctrl+Z)`` enables you to capture the entire screen. When you choose this option, the Screen Grab dialog appears. Click outside the dialog to capture the screen.
* Timed Screen ``(Shift+Ctrl+Z)`` enables you to capture the entire screen after a ten-second delay. When you choose this option, the Timed Screen Grab dialog appears. Click the Start Timer button, then activate the program you want to capture and arrange screen elements as desired. In ten seconds, the screen is captured.
4. ``Grab`` makes a camera shutter sound as it captures the screen. The image appears in an untitled document window.
5. If you are satisfied with the screenshot, choose ``File > Save`` or press ``(Ctrl+S)`` and use the Save As dialog sheet that appears to save it as a file on disk or if you are not satisfied with the screenshot, choose ``File > Close`` or press ``(Ctrl+W)`` to close the window. In the Close dialog sheet, click Don't Save.

You can create screenshots without ``Grab``. Press ``(Shift+Ctrl+3)`` to capture the entire screen or ``(Shift+Ctrl+4)`` to capture a portion of the screen. The screenshot is automatically saved on the desktop as a PNG file.
31 changes: 31 additions & 0 deletions Under Construction/Grab.app/Resources/dialog_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os

from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog
from PyQt5.QtCore import pyqtSignal
from dialog_help_ui import Ui_HelpDialog


class HelpDialog(QDialog):
screen_dialog_signal_quit = pyqtSignal()
screen_dialog_signal_start = pyqtSignal()

def __init__(self, parent=None):
super(HelpDialog, self).__init__(parent)
self.ui = Ui_HelpDialog()
self.ui.setupUi(self)
self.setup()

def setup(self):

self.setWindowIcon(QIcon(os.path.join(os.path.dirname(__file__), "Grab.png")))
self.open()
self.setFocus()

def open(self) -> None:
with open(os.path.join(os.path.dirname(__file__), "README.md"), "r") as file:
text = file.read()
self.ui.textBrowser.setMarkdown(text)



36 changes: 36 additions & 0 deletions Under Construction/Grab.app/Resources/dialog_help.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HelpDialog</class>
<widget class="QDialog" name="HelpDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<height>458</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="textBrowser"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
30 changes: 30 additions & 0 deletions Under Construction/Grab.app/Resources/dialog_help_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file './dialog_help.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_HelpDialog(object):
def setupUi(self, HelpDialog):
HelpDialog.setObjectName("HelpDialog")
HelpDialog.resize(541, 458)
self.verticalLayout = QtWidgets.QVBoxLayout(HelpDialog)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.textBrowser = QtWidgets.QTextBrowser(HelpDialog)
self.textBrowser.setObjectName("textBrowser")
self.verticalLayout.addWidget(self.textBrowser)

self.retranslateUi(HelpDialog)
QtCore.QMetaObject.connectSlotsByName(HelpDialog)

def retranslateUi(self, HelpDialog):
_translate = QtCore.QCoreApplication.translate
HelpDialog.setWindowTitle(_translate("HelpDialog", "Dialog"))
88 changes: 88 additions & 0 deletions Under Construction/Grab.app/Resources/dialog_screen_grab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import os

from PyQt5.QtCore import pyqtSignal, Qt, QEvent
from PyQt5.QtGui import QPixmap, QIcon, QFocusEvent, QKeySequence
from PyQt5.QtWidgets import QDialog, QDesktopWidget, QShortcut

from dialog_screen_grab_ui import Ui_ScreenGrabDialog


class ScreenGrabDialog(QDialog):
screen_dialog_signal_quit = pyqtSignal()
screen_dialog_signal_start = pyqtSignal()

def __init__(self, parent=None):
super(ScreenGrabDialog, self).__init__(parent)

self.ui = Ui_ScreenGrabDialog()
self.ui.setupUi(self)

self.setupCustomUi()
self.connectSignalsSlots()
self.initialState()

def setupCustomUi(self):
self.setWindowFlags(
Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowStaysOnTopHint
)
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.ui.icon.setPixmap(
QPixmap(os.path.join(os.path.dirname(__file__), "Grab.png")).scaled(
48, 48, Qt.KeepAspectRatio, Qt.SmoothTransformation
)
)

self.setWindowIcon(QIcon(os.path.join(os.path.dirname(__file__), "Grab.png")))

def connectSignalsSlots(self):
self.ui.button_cancel.clicked.connect(self.screen_dialog_quit)
# QShortcut(QKeySequence("Escape"), self)
quitShortcut1 = QShortcut(QKeySequence("Escape"), self)
quitShortcut1.activated.connect(self.screen_dialog_quit)

# QShortcut(QKeySequence("Ctrl+C"), activated=self.on_Ctrl_C)

def initialState(self):
self.adjustSize()
self.setFixedSize(self.size())
self.center()
self.setFocus()

def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())

# def eventFilter(self, source, event):
# if event.type() == QEvent.Close and source is self:
# self.close()
#
# elif event.type() == QEvent.FocusOut:
# print('eventFilter: focus out')
# if self.hasFocus() or self.ui.button_cancel.hasFocus():
# event.accept()
#
# else:
# super(ScreenGrabDialog, self).close()
# event.accept()
# self.screen_dialog_signal_start.emit()
#
#
# return super(ScreenGrabDialog, self).eventFilter(source, event)

def focusOutEvent(self, event: QFocusEvent) -> None:
if self.hasFocus() or self.ui.button_cancel.hasFocus():
event.accept()
else:
super(ScreenGrabDialog, self).close()
event.accept()
self.screen_dialog_signal_start.emit()

def screen_dialog_quit(self):
self.screen_dialog_signal_quit.emit()
self.close()

def screen_dialog_cancel(self):
self.close()
Loading