agudpp / alias Goto Github PK
View Code? Open in Web Editor NEWProductivity app for accessing content (commands, text, etc) (super) fast content using tags.
License: MIT License
Productivity app for accessing content (commands, text, etc) (super) fast content using tags.
License: MIT License
instead of having
if (event->key() == Qt::Key_Up)
we can have:
if (is_up_set.check(event->key())) {
is_up_set is a configurable set where we can add keys (so it is also possible to configure over a config file)
probably when the index of the list is -1 pressing up is not taken into account.
will be handy if we can edit tags
diff --git a/README.md b/README.md
index 95ae6fa..27f4b1a 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,26 @@ tag-linker
==========
Tool to be used to link "elements" with tags or links
+
+
+# Dependencies
+
+You will need to set the following env variables, replacing `<git_folder>` pointing
+to the proper path where you got the folder:
+
+```
+export TAG_BACKEND_GIT=<git_folder>/backend_version/
+export TAG_BACKEND_BUILDS=<git_folder>/builds/
+```
+
+## UI
+
+On the folder `ui/qt` you can execute (using python3.5):
+```
+pip install -r requirements.txt
+```
+
+## Backend
+- CMake
+- C++ compiler and libs (C++11)
+
diff --git a/backend_version/ui/qt/clipboard_helper.py b/backend_version/ui/qt/clipboard_helper.py
new file mode 100644
index 0000000..1c8243b
--- /dev/null
+++ b/backend_version/ui/qt/clipboard_helper.py
@@ -0,0 +1,23 @@
+from sys import platform
+if platform == "linux" or platform == "linux2":
+ # linux
+ print('linux')
+elif platform == "darwin":
+ # OS X
+ import subprocess
+ print('osx')
+elif platform == "win32":
+ # Windows...
+ print('windows')
+
+class ClipboardHelper:
+ def __init__(self):
+ # nothing to do for now
+ return
+
+ def copyToClipboard(self, data):
+ if platform == "darwin":
+ process = subprocess.Popen(
+ 'pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE)
+ process.communicate(data.encode('utf-8'))
+
diff --git a/backend_version/ui/qt/input_window.py b/backend_version/ui/qt/input_window.py
index bb5f42d..9e4601e 100644
--- a/backend_version/ui/qt/input_window.py
+++ b/backend_version/ui/qt/input_window.py
@@ -1,5 +1,5 @@
import sys
-from PyQt5.QtCore import Qt
+from PyQt5.QtCore import Qt, pyqtSignal
import PyQt5.QtCore
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QWidget
@@ -9,8 +9,12 @@ from be_conn import BEConnector
class InputWindow(QWidget):
- def __init__(self, beConn):
- super(InputWindow, self).__init__()
+
+ # when it is being closed
+ closing = pyqtSignal()
+
+ def __init__(self, parent, beConn):
+ super(InputWindow, self).__init__(parent)
# backend connector
self.beConn = beConn
@@ -31,7 +35,7 @@ class InputWindow(QWidget):
# inputKeyPressed = pyqtSignal(int)
self.tagHandler.inputKeyPressed.connect(self.inputKeyPressed)
-
+
# newTagHighlighted = pyqtSignal(bool, str)
self.tagHandler.newTagHighlighted.connect(self.newTagHighlighted)
@@ -91,6 +95,7 @@ class InputWindow(QWidget):
# we should save there the information and close
print('saving data')
self._saveCurrentDataOnBE()
+ self.close()
else:
print('Key not handled?')
@@ -119,6 +124,11 @@ class InputWindow(QWidget):
return
self._configureFromLastResults()
+ def closeEvent(self, evt):
+ self.closing.emit()
+ #super(QWidget, self).closeEvent(evt)
+ evt.accept()
+
def _queryBackend(self, q):
return self.beConn.performGetTags(q)
@@ -144,19 +154,19 @@ class InputWindow(QWidget):
# TODO: remove this
-def center(win):
- frameGm = win.frameGeometry()
- screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
- centerPoint = QApplication.desktop().screenGeometry(screen).center()
- frameGm.moveCenter(centerPoint)
- win.move(frameGm.topLeft())
+# def center(win):
+# frameGm = win.frameGeometry()
+# screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
+# centerPoint = QApplication.desktop().screenGeometry(screen).center()
+# frameGm.moveCenter(centerPoint)
+# win.move(frameGm.topLeft())
-app = QApplication(sys.argv)
-window = InputWindow(BEConnector())
-# ui = Ui_MainWindow()
-# ui.setupUi(window)
+# app = QApplication(sys.argv)
+# window = InputWindow(BEConnector())
+# # ui = Ui_MainWindow()
+# # ui.setupUi(window)
-window.show()
-center(window)
-sys.exit(app.exec_())
+# window.show()
+# center(window)
+# sys.exit(app.exec_())
diff --git a/backend_version/ui/qt/requirements.txt b/backend_version/ui/qt/requirements.txt
new file mode 100644
index 0000000..fd41258
--- /dev/null
+++ b/backend_version/ui/qt/requirements.txt
@@ -0,0 +1,7 @@
+certifi==2017.7.27.1
+chardet==3.0.4
+idna==2.5
+PyQt5==5.9
+requests==2.18.3
+sip==4.19.3
+urllib3==1.22
diff --git a/backend_version/ui/qt/test.py b/backend_version/ui/qt/test.py
index 9887339..8c4caa5 100644
--- a/backend_version/ui/qt/test.py
+++ b/backend_version/ui/qt/test.py
@@ -6,6 +6,15 @@ from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog, QLineEdit
from ui_mainwindow import Ui_MainWindow
from tag_handler import TagHandler
from be_conn import BEConnector
+from input_window import InputWindow
+from clipboard_helper import ClipboardHelper
+
+def center(win):
+ frameGm = win.frameGeometry()
+ screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
+ centerPoint = QApplication.desktop().screenGeometry(screen).center()
+ frameGm.moveCenter(centerPoint)
+ win.move(frameGm.topLeft())
class MyMainWindow(QMainWindow):
@@ -32,7 +41,7 @@ class MyMainWindow(QMainWindow):
# inputKeyPressed = pyqtSignal(int)
self.tagHandler.inputKeyPressed.connect(self.inputKeyPressed)
-
+
# newTagHighlighted = pyqtSignal(bool, str)
self.tagHandler.newTagHighlighted.connect(self.newTagHighlighted)
@@ -43,6 +52,13 @@ class MyMainWindow(QMainWindow):
self.tagHandler.optionalTagSelected.connect(self.optionalTagSelected)
self.tagHandler.newTagSelected.connect(self.newTagSelected)
+ # input window
+ self.inputWindow = None
+
+ # clipboard helper
+ self.clipboardHelper = ClipboardHelper()
+
+
# Here we will define all slots that will define the logic depending on
@@ -59,6 +75,7 @@ class MyMainWindow(QMainWindow):
if key == Qt.Key_Escape:
self.close()
elif key == Qt.Key_Up or key == Qt.Key_Down:
+ print('selecting rows / elements')
self._moveResults(key == Qt.Key_Down)
elif key == Qt.Key_Return:
modifiers = QApplication.keyboardModifiers()
@@ -67,7 +84,7 @@ class MyMainWindow(QMainWindow):
# we will open the input window
self._showInputWindow()
return
-
+
# check if we want to select one of the items
currentRow = self.ui.resultList.currentRow()
if currentRow >= 0:
@@ -77,9 +94,10 @@ class MyMainWindow(QMainWindow):
if currItem:
textToCopy = currItem.text()
print('current item copied: ', textToCopy)
- clipboard = QApplication.clipboard()
- clipboard.clear(mode=clipboard.Clipboard )
- clipboard.setText(textToCopy, mode=clipboard.Clipboard)
+ # clipboard = QApplication.clipboard()
+ # clipboard.clear(mode=clipboard.Clipboard )
+ # clipboard.setText(textToCopy, mode=clipboard.Clipboard)
+ self.clipboardHelper.copyToClipboard(textToCopy)
self.close()
return
# we want to select a item?
@@ -149,15 +167,22 @@ class MyMainWindow(QMainWindow):
self.ui.resultList.addItem(er['content'])
def _showInputWindow(self):
+ if self.inputWindow:
+ print('input window exists, showing it')
+ self.inputWindow.show()
+ center(self.inputWindow)
+ return
+ print('input window doesnt exists, creating one')
+ self.inputWindow = InputWindow(self, self.beConn)
+ self.inputWindow.show()
+ center(self.inputWindow)
+ self.inputWindow.closing.connect(self._inputWindowClosed)
+
+ def _inputWindowClosed(self):
+ # nothing to do here
return
-def center(win):
- frameGm = win.frameGeometry()
- screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
- centerPoint = QApplication.desktop().screenGeometry(screen).center()
- frameGm.moveCenter(centerPoint)
- win.move(frameGm.topLeft())
app = QApplication(sys.argv)
We need to improve the current ui design to look much nicer. whoever wants to help :).
It is C++ Qt!
would be good if something have "tmp" or "temp" or special tag that will not be stored on the harddrive but just on memory
having a queue of the last N copied to clipboard text we can later perform a search on that data
we are using string now we can improve this
https://kb.froglogic.com/display/KB/Problem+-+Bringing+window+to+foreground+%28Qt%29
We can try to create a window, hide it, when the user press a combination -> make it visible -> fork the process (faster load?)
https://stackoverflow.com/questions/26882803/how-i-show-application-when-open-application-again-qt
will be buggy otherwise
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.