Code Monkey home page Code Monkey logo

alias's People

Contributors

agudpp avatar aguperezpala avatar agustin-cliqz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

strider29

alias's Issues

list of issues

TODOS

Backend

  • implement storage when we add a new element on the data
  • add cache for queries?
  • implement better storage logic (not dump all at once)
  • add element types + add support for extra filtering on element type (using maybe #tag will be enough to specify the type on the frontend side)

Frontend

  • organize BE connector and use the proper interface, now we are caching data very bad and the names are not matching the BE. We should organize and define proper interface here
  • implement the addTagElement on be_conn.py
  • add / define how we will implement the element type (adding #tag will be enough? makes any sense to add a type on the elements on the BE?).
  • finish the ui_input_window logic / implementation.

apply patch or commit from mac

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)

improve ui design

We need to improve the current ui design to look much nicer. whoever wants to help :).
It is C++ Qt!

add temporary objects

would be good if something have "tmp" or "temp" or special tag that will not be stored on the harddrive but just on memory

integrate client qt project

  • Add qt cmake integration
  • define content types (text for now)
  • implement the new design structure
  • include the qtClient old integration for single run
  • hooks for key press callbacks (show screen on key press)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.