Skip to content

Commit

Permalink
Merge branch 'main' into CURA-10475_engineplugin
Browse files Browse the repository at this point in the history
# Conflicts:
#	resources/i18n/cs_CZ/uranium.po
#	resources/i18n/de_DE/uranium.po
#	resources/i18n/es_ES/uranium.po
#	resources/i18n/fi_FI/uranium.po
#	resources/i18n/fr_FR/uranium.po
#	resources/i18n/hu_HU/uranium.po
#	resources/i18n/it_IT/uranium.po
#	resources/i18n/ja_JP/uranium.po
#	resources/i18n/ko_KR/uranium.po
#	resources/i18n/nl_NL/uranium.po
#	resources/i18n/pl_PL/uranium.po
#	resources/i18n/pt_BR/uranium.po
#	resources/i18n/pt_PT/uranium.po
#	resources/i18n/ru_RU/uranium.po
#	resources/i18n/tr_TR/uranium.po
#	resources/i18n/uranium.pot
#	resources/i18n/zh_CN/uranium.po
#	resources/i18n/zh_TW/uranium.po
  • Loading branch information
jellespijker committed Aug 1, 2023
2 parents 6a8c6c0 + 012a475 commit b80bfea
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 18 deletions.
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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\n"
"Language-Team: Finnish <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion 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-18 10:33+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 <[email protected]>\n"
Expand Down
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-18 10:33+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 <[email protected]>\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-18 10:33+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 <[email protected]>\n"
"Language-Team: Valen Chang <[email protected]>\n"
Expand Down

0 comments on commit b80bfea

Please sign in to comment.