Skip to content

Commit

Permalink
About Window (#22)
Browse files Browse the repository at this point in the history
* closes #14

* Update README.md
  • Loading branch information
rllola authored Nov 29, 2020
1 parent 3204054 commit 4d6d0aa
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ sudo apt install libffi-dev

It takes too long to build in CI. Instead builds are being done locally on my computer (maybe for the best).
```
make release TAG=v0.x.x
make build
```

Using semver standard.
Expand Down
2 changes: 1 addition & 1 deletion airbnb-scanner.pdy

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
build:
python build.py --no-sysroot
mkdir -p pkg-debian/usr/share/AirbnbScanner
cp build-linux-64/AirbnbScanner pkg-debian/usr/share/AirbnbScanner/AirbnbScanner
dpkg -b pkg-debian AirbnbScanner_test_i386.deb
VERSION = $$(head -n 1 src/__init__.py | grep -o '"[^"]\+"' | sed 's/"//g')

release:
build:
python build.py --no-sysroot
./scripts/generate_deb_files.sh $(TAG)
./scripts/generate_deb_files.sh $(VERSION)
mkdir -p pkg-debian/usr/share/AirbnbScanner
cp build-linux-64/AirbnbScanner pkg-debian/usr/share/AirbnbScanner/AirbnbScanner
dpkg -b pkg-debian AirbnbScanner_$(TAG)_i386.deb
dpkg -b pkg-debian AirbnbScanner_v$(VERSION)_i386.deb

clean:
rm -rf build-*/
rm -rf pkg-debian/usr/share/AirbnbScanner
rm *.deb

install:
sudo dpkg -i AirbnbScanner_$(TAG)_i386.deb
sudo dpkg -i AirbnbScanner_v$(VERSION)_i386.deb

uninstall:
sudo dpkg -r airbnbscanner
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_deb_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TAG=$1
echo "====== GENERATE CONTROL FILE ======"
cat > $PWD/pkg-debian/DEBIAN/control << EOF
Package: AirbnbScanner
Version: ${TAG/v}
Version: ${TAG}
Architecture: all
Essential: no
Section: utils
Expand All @@ -19,7 +19,7 @@ mkdir -p $PWD/pkg-debian/usr/share/applications/
echo "====== GENERATE .DESKTOP FILE ======"
cat > $PWD/pkg-debian/usr/share/applications/airbnb-scanner.desktop << EOF
[Desktop Entry]
Version=${TAG/v}
Version=${TAG}
Name=Airbnb Scanner
Comment=Device scanner to get the camera in your Airbnb.
Exec=AirbnbScanner %u
Expand Down
3 changes: 3 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__version__ = "0.1.0"
__author__ = "Lola Rigaut-Luczak"
__email__ = "[email protected]"
36 changes: 36 additions & 0 deletions src/about.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout
from PyQt5.QtCore import Qt

from __init__ import __version__, __author__, __email__

class AboutWidget(QWidget):
"""AboutWiget class"""

def __init__(self):
super().__init__()
layout = QVBoxLayout()
self.label = QLabel()
self.label.setOpenExternalLinks(True)
self.label.setTextFormat(Qt.RichText)
self.label.setText(
"""
<center>
<b>Airbnb Scanner</b><br/>
Version v{version}
<br/><br/>
Created and maintained by {author} (<a href="mailto:{email}">{email}</a>).
<br/><br/>
</center>
Source code : <a href="https://github.com/rllola/airbnb-scanner">https://github.com/rllola/airbnb-scanner</a><br/>
Report and issue : <a href="https://github.com/rllola/airbnb-scanner/issues">https://github.com/rllola/airbnb-scanner/issues</a> <br/><br/>
Under <a href="http://www.wtfpl.net/">Do What the Fuck You Want to Public License</a>.
""".format(version=__version__, author=__author__, email=__email__)
)
layout.addWidget(self.label)
self.setWindowTitle("About")
self.setLayout(layout)

def closeEvent(self, event):
# Just hide the widget
event.ignore()
self.hide()
13 changes: 11 additions & 2 deletions src/application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QFile, QIODevice, QDir

from about import AboutWidget

import json
import scapy.all as scapy
import os
Expand All @@ -14,13 +17,19 @@ def __init__(self, *args, **kwargs):
super(QApplication,self).__init__(*args, **kwargs)
print('Application initiated')

self.about_window = AboutWidget()

print("Creating menu...")
# TODO: Create a menu class
# BODY: Create a menu class to make Application class lighter.
self.menu = QMenu()
self.device_menu = QMenu("Devices")
self.separator = self.menu.addSeparator()
self.aboutAction = self.menu.addAction("About")
self.aboutAction.triggered.connect(self.about_window.show)
self.quitAction = self.menu.addAction("Quit")
self.quitAction.triggered.connect(self.quit)

prefix_path = "."

if ":/" in sys.path:
Expand All @@ -41,7 +50,7 @@ def __init__(self, *args, **kwargs):
self.tray.show()

# We are scanning local IP
self.scan('192.168.1.0/24')
self.scan('192.168.1.0/24')

def rescan(self):
self.device_menu.clear()
Expand Down

0 comments on commit 4d6d0aa

Please sign in to comment.