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

Cura about dialog when shaked gives extra info #889

Merged
merged 3 commits into from
Jul 26, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ resources/.DS_Store
plugins/UraniumExample*Plugin
/conanbuildinfo.txt
/graph_info.json
/venv/
2 changes: 2 additions & 0 deletions UM/Qt/Bindings/Bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from . import VisibleMessagesModel
from . import Utilities
from . import TableModel
from . import ShakeDetector

from UM.Settings.Models.SettingDefinitionsModel import SettingDefinitionsModel
from UM.Settings.Models.DefinitionContainersModel import DefinitionContainersModel
Expand Down Expand Up @@ -123,6 +124,7 @@ def register(self):
# Additions after 5.0
qmlRegisterType(TableModel.TableModel, "UM", 1, 6, "TableModel")
qmlRegisterType(Window.Window, "UM", 1, 6, "Window")
qmlRegisterType(ShakeDetector.ShakeDetector, "UM", 1,6, "ShakeDetector" )

@staticmethod
def addRegisterType(class_type: type, qml_import_name: str, major_version: int, minor_version: int, class_name: str) -> None:
Expand Down
46 changes: 46 additions & 0 deletions UM/Qt/Bindings/ShakeDetector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty

from typing import Optional

class ShakeDetector(QObject):
shakeDetected = pyqtSignal()
pointChanged = pyqtSignal()

def getPoint(self) -> Optional["QPoint"]:
return self._curr_pos

def setPoint(self, point: "QPoint"):
self._curr_pos = point
self.pointChanged.emit()

position = pyqtProperty('QPoint', fget=getPoint, fset=setPoint, notify=pointChanged)

def __init__(self, _parent = None):
super().__init__()

self._curr_pos = None
self._prev_pos = None
self.threshold = 50
self.shake_count = 0
self.number_of_shakes = 0

self.pointChanged.connect(self._checkForShake)

def _checkForShake(self):
if self._prev_pos is not None:
# Calculate the distance moved between the previous and current positions
distance = ((self._curr_pos.x() - self._prev_pos.x()) ** 2 + (self._curr_pos.y() - self._curr_pos.y()) ** 2) ** 0.5
# If the distance is greater than a threshold, emit the shakeDetected signal
if distance > self.threshold:
self.shake_count += 1
if self.shake_count > 10:
self.shake_count = 0
self.number_of_shakes += 1
self.shakeDetected.emit()

# Update the previous position with the current one
self._prev_pos = self._curr_pos

@pyqtProperty(int, notify = shakeDetected)
def shakeIsdetected(self):
return self.number_of_shakes
2 changes: 1 addition & 1 deletion resources/i18n/cs_CZ/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2022-04-26 00:14+0200\n"
"Last-Translator: Miroslav Šustek <sustmidown@centrum.cz>\n"
"Language-Team: DenyCZ <www.github.com/DenyCZ>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/de_DE/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/es_ES/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/fi_FI/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2017-09-27 12:27+0200\n"
"Last-Translator: Bothof <info@bothof.nl>\n"
"Language-Team: Finnish <info@bothof.nl>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/fr_FR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/hu_HU/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2019-10-10 22:30+0200\n"
"Last-Translator: Nagy Attila\n"
"Language-Team: AT-VLOG <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/it_IT/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ja_JP/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ko_KR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/nl_NL/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pl_PL/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2019-11-15 15:35+0100\n"
"Last-Translator: Mariusz 'Virgin71' Matłosz <matliks@gmail.com>\n"
"Language-Team: reprapy.pl\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pt_BR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2022-04-25 07:03+0200\n"
"Last-Translator: Cláudio Sampaio <patola@gmail.com>\n"
"Language-Team: Cláudio Sampaio\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pt_PT/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ru_RU/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/tr_TR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
62 changes: 31 additions & 31 deletions resources/i18n/uranium.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -598,122 +598,122 @@ msgid "Local Container Provider"
msgstr ""

msgctxt "description"
msgid "Provides the Rotate tool."
msgid "Enables saving to local files."
msgstr ""

msgctxt "name"
msgid "Rotate Tool"
msgid "Local File Output Device"
msgstr ""

msgctxt "description"
msgid "Provides the Move tool."
msgid "Makes it possible to read Wavefront OBJ files."
msgstr ""

msgctxt "name"
msgid "Move Tool"
msgid "Wavefront OBJ Reader"
msgstr ""

msgctxt "description"
msgid "Provides the tool to manipulate the camera."
msgid "Provides support for writing STL files."
msgstr ""

msgctxt "name"
msgid "Camera Tool"
msgid "STL Writer"
msgstr ""

msgctxt "description"
msgid "Provides the Mirror tool."
msgid "Provides support for reading STL files."
msgstr ""

msgctxt "name"
msgid "Mirror Tool"
msgid "STL Reader"
msgstr ""

msgctxt "description"
msgid "Provides the Scale tool."
msgid "Makes it possible to write Wavefront OBJ files."
msgstr ""

msgctxt "name"
msgid "Scale Tool"
msgid "Wavefront OBJ Writer"
msgstr ""

msgctxt "description"
msgid "Provides the Selection tool."
msgid "Outputs log information to the console."
msgstr ""

msgctxt "name"
msgid "Selection Tool"
msgid "Console Logger"
msgstr ""

msgctxt "description"
msgid "Enables saving to local files."
msgid "Outputs log information to a file in your settings folder."
msgstr ""

msgctxt "name"
msgid "Local File Output Device"
msgid "File Logger"
msgstr ""

msgctxt "description"
msgid "Outputs log information to a file in your settings folder."
msgid "Provides a simple solid mesh view."
msgstr ""

msgctxt "name"
msgid "File Logger"
msgid "Simple View"
msgstr ""

msgctxt "description"
msgid "Outputs log information to the console."
msgid "Checks for updates of the software."
msgstr ""

msgctxt "name"
msgid "Console Logger"
msgid "Update Checker"
msgstr ""

msgctxt "description"
msgid "Checks for updates of the software."
msgid "Provides the Mirror tool."
msgstr ""

msgctxt "name"
msgid "Update Checker"
msgid "Mirror Tool"
msgstr ""

msgctxt "description"
msgid "Makes it possible to read Wavefront OBJ files."
msgid "Provides the Move tool."
msgstr ""

msgctxt "name"
msgid "Wavefront OBJ Reader"
msgid "Move Tool"
msgstr ""

msgctxt "description"
msgid "Makes it possible to write Wavefront OBJ files."
msgid "Provides the Rotate tool."
msgstr ""

msgctxt "name"
msgid "Wavefront OBJ Writer"
msgid "Rotate Tool"
msgstr ""

msgctxt "description"
msgid "Provides support for reading STL files."
msgid "Provides the tool to manipulate the camera."
msgstr ""

msgctxt "name"
msgid "STL Reader"
msgid "Camera Tool"
msgstr ""

msgctxt "description"
msgid "Provides support for writing STL files."
msgid "Provides the Scale tool."
msgstr ""

msgctxt "name"
msgid "STL Writer"
msgid "Scale Tool"
msgstr ""

msgctxt "description"
msgid "Provides a simple solid mesh view."
msgid "Provides the Selection tool."
msgstr ""

msgctxt "name"
msgid "Simple View"
msgid "Selection Tool"
msgstr ""

2 changes: 1 addition & 1 deletion resources/i18n/zh_CN/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/zh_TW/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-25 09:26+0000\n"
"PO-Revision-Date: 2022-01-02 20:28+0800\n"
"Last-Translator: Valen Chang <carf17771@gmail.com>\n"
"Language-Team: Valen Chang <carf17771@gmail.com>\n"
Expand Down
Loading