From 3cadfda599d8c5bfa83a77d11df7b0fdc0db43b0 Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Sun, 15 Aug 2021 12:11:51 +0200 Subject: [PATCH] Spreadsheet output added --- mainwindow.ui | 199 +++++++++++++++++++++++++++++----------- twintgui.py | 25 +++-- twintgui.pyproject.user | 12 +-- 3 files changed, 164 insertions(+), 72 deletions(-) diff --git a/mainwindow.ui b/mainwindow.ui index 5f31668..d396a85 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -67,8 +67,8 @@ p, li { white-space: pre-wrap; } - 110 - 380 + 140 + 400 95 27 @@ -135,37 +135,11 @@ p, li { white-space: pre-wrap; } FileName - - - - 390 - 10 - 571 - 341 - - - - - - - 10 - 300 - 94 - 24 - - - - Popular? - - - false - - 70 - 330 + 310 110 29 @@ -174,9 +148,9 @@ p, li { white-space: pre-wrap; } - 0 - 330 - 66 + 10 + 310 + 41 31 @@ -187,8 +161,8 @@ p, li { white-space: pre-wrap; } - 270 - 330 + 260 + 310 110 29 @@ -197,9 +171,9 @@ p, li { white-space: pre-wrap; } - 200 - 330 - 66 + 210 + 310 + 31 31 @@ -207,28 +181,147 @@ p, li { white-space: pre-wrap; } Until - - - - - 0 - 0 - 980 - 29 - - - - - TwintGUI + + + + 400 + 21 + 571 + 361 + + + + 100 + + + 4 + + + 140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 70 + 360 + 94 + 24 + + + + Popular - - - & Close + Close diff --git a/twintgui.py b/twintgui.py index aaa6863..4674f9d 100644 --- a/twintgui.py +++ b/twintgui.py @@ -1,6 +1,6 @@ # main.py - +import os import sys from PySide6 import * from PySide6 import QtWidgets @@ -8,25 +8,23 @@ from PySide6.QtUiTools import QUiLoader import twint from PySide6.QtWidgets import QApplication, QPushButton from PySide6.QtCore import Slot - - -import os +import sqlite3 #Ggsya made this :D def backslash(): return('\ '[0]) -#def check_and_create_dir(path): - # if os.path.exists(path): - # print('Dir already exists') - # print('Exiting') - # else: - # os.mkdir(path) +def check_and_create_dir(path): + if os.path.exists(path): + print('Dir already exists') + print('Exiting') + else: + os.mkdir(path) def tweet_search(): #checking if output folder exists - # check_and_create_dir(os.getcwd() + '\output') + check_and_create_dir(os.getcwd() + '\output') search = window.Keyword.toPlainText() city = window.City.toPlainText() @@ -41,6 +39,7 @@ def tweet_search(): c.Search = search c.Near = city c.Limit = limit + c.Store_csv = True c.Popular_tweets = window.Popular.checkState() #c.Since = window.Since @@ -48,8 +47,8 @@ def tweet_search(): #c.Username = #filename becomes the file path - #filename = os.getcwd() + '\output' + backslash() + window.Filename.toPlainText() + '.txt' - #c.Output = filename + filename = os.getcwd() + '\output' + backslash + window.Filename.toPlainText() + c.Output = filename twint.run.Search(c) diff --git a/twintgui.pyproject.user b/twintgui.pyproject.user index a930820..df9beee 100644 --- a/twintgui.pyproject.user +++ b/twintgui.pyproject.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -173,16 +173,16 @@ 2 - /home/linly/Documents/Work/Apps/TwintGUI/twintgui.py - PythonEditor.RunConfiguration./home/linly/Documents/Work/Apps/TwintGUI/twintgui.py - /home/linly/Documents/Work/Apps/TwintGUI/twintgui.py + /home/linly/Work/Apps/TweetSearcherPOG/twintgui.py + PythonEditor.RunConfiguration./home/linly/Work/Apps/TweetSearcherPOG/twintgui.py + /home/linly/Work/Apps/TweetSearcherPOG/twintgui.py {f1c2d9db-f11e-401c-8982-385dc026078c} - /home/linly/Documents/Work/Apps/TwintGUI/twintgui.py + /home/linly/Work/Apps/TweetSearcherPOG/twintgui.py false true false true - /home/linly/Documents/Work/Apps/TwintGUI + /home/linly/Work/Apps/TweetSearcherPOG 1