Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Release 3.3 Stable #69

Merged
merged 5 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions guiscrcpy/install/finder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
from PyQt5.QtWidgets import QFileDialog


def openFileNameDialog(parent, appname):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = \
QFileDialog.getOpenFileName(parent, "{} could not be found. Please locate it manually".format(appname),
"", "Valid {} executable (*);;".format(appname), options=options)
if fileName:
print(fileName)
return fileName
Empty file removed guiscrcpy/install/installer.py
Empty file.
46 changes: 35 additions & 11 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,19 @@
except FileNotFoundError:
pass # Its a PyInstaller compiled package

# create app





# initialize config manager
cfgmgr = InterfaceConfig()
config = cfgmgr.get_config()
environment = platform.System()
adb.path = config['adb']
scrcpy.path = config['scrcpy']
scrcpy.server_path = config['scrcpy-server']
v = version()

# Initialize argument parser
Expand Down Expand Up @@ -141,11 +148,11 @@
logging.debug("Importing modules...")


class InterfaceGuiscrcpy(Ui_MainWindow):
def __init__(self, Ui_MainWindow):
Ui_MainWindow.__init__()
self.setupUi(Ui_MainWindow)
super(InterfaceGuiscrcpy, self).__init__()
class InterfaceGuiscrcpy(QMainWindow, Ui_MainWindow):
def __init__(self):
QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.cmx = None
logging.debug(
"Options received by class are : {} {} {} {} {} ".format(
Expand Down Expand Up @@ -465,20 +472,37 @@ def bootstrap0():
app.setStyle('Breeze')
app.setStyleSheet(darkstylesheet())

window = QtWidgets.QMainWindow() # Create windwo
prog = InterfaceGuiscrcpy(window)

splash_pix = QPixmap(":/res/ui/guiscrcpy-branding.png")
splash = QtWidgets.QSplashScreen(splash_pix)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
cfedited = False

adb.devices(adb.path)
from guiscrcpy.install.finder import openFileNameDialog
if adb.path is None:
adb.path = openFileNameDialog(None, 'adb')
cfedited = True
config['adb'] = adb.path

app.processEvents()
if scrcpy.path is None:
scrcpy.path = openFileNameDialog(None, 'scrcpy')
cfedited = True
config['scrcpy'] = scrcpy.path

if (scrcpy.server_path is None) and (platform.System() == 'Windows'):
scrcpy.server_path = openFileNameDialog(None, 'scrcpy-server')
cfedited = True
config['scrcpy-server'] = scrcpy.server_path

window.show()
if cfedited:
cfgmgr.update_config(config)
cfgmgr.write_file()

adb.devices(adb.path)
prog = InterfaceGuiscrcpy()
prog.show()
app.processEvents()
splash.hide()
app.exec_()
sys.exit()
Expand Down
3 changes: 3 additions & 0 deletions guiscrcpy/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, mode='w'):
'paths': self.paths,
'scrcpy': None,
'adb': None,
'scrcpy-server': None,
'dimension': None,
'swtouches': False,
'bitrate': 8000,
Expand All @@ -57,6 +58,8 @@ def validate(self):
scrcpy_path = scrcpy.check()
if scrcpy_path:
self.config['scrcpy'] = scrcpy_path
if (self.config['scrcpy-server'] is not None) and (platform.System() == "Windows"):
os.environ['SCRCPY_SERVER_PATH'] = self.config['scrcpy-server']
return True

def get_config(self):
Expand Down
59 changes: 59 additions & 0 deletions guiscrcpy/ui/downloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'guiscrcpy/ui/downloader.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Initializer(object):
def setupUi(self, Initializer):
Initializer.setObjectName("Initializer")
Initializer.resize(222, 320)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/res/ui/guiscrcpy_logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
Initializer.setWindowIcon(icon)
self.widget = QtWidgets.QWidget(Initializer)
self.widget.setGeometry(QtCore.QRect(0, 0, 221, 311))
self.widget.setObjectName("widget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.label_2 = QtWidgets.QLabel(self.widget)
self.label_2.setText("")
self.label_2.setTextFormat(QtCore.Qt.PlainText)
self.label_2.setPixmap(QtGui.QPixmap(":/res/ui/guiscrcpy_logo.png"))
self.label_2.setScaledContents(True)
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setWordWrap(True)
self.label_2.setObjectName("label_2")
self.verticalLayout.addWidget(self.label_2)
self.stat = QtWidgets.QLabel(self.widget)
font = QtGui.QFont()
font.setFamily("Titillium Web")
font.setPointSize(30)
font.setBold(True)
font.setWeight(75)
self.stat.setFont(font)
self.stat.setScaledContents(False)
self.stat.setAlignment(QtCore.Qt.AlignCenter)
self.stat.setObjectName("stat")
self.verticalLayout.addWidget(self.stat)
self.label_3 = QtWidgets.QLabel(self.widget)
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.verticalLayout.addWidget(self.label_3)

self.retranslateUi(Initializer)
QtCore.QMetaObject.connectSlotsByName(Initializer)

def retranslateUi(self, Initializer):
_translate = QtCore.QCoreApplication.translate
Initializer.setWindowTitle(_translate("Initializer", "Initializing"))
self.stat.setText(_translate("Initializer", "guiscrcpy"))
self.label_3.setText(_translate("Initializer", "Initializing"))
from . import rsrc_rc
93 changes: 93 additions & 0 deletions guiscrcpy/ui/downloader.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Initializer</class>
<widget class="QDialog" name="Initializer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>222</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>Initializing</string>
</property>
<property name="windowIcon">
<iconset resource="rsrc.qrc">
<normaloff>:/res/ui/guiscrcpy_logo.png</normaloff>:/res/ui/guiscrcpy_logo.png</iconset>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>221</width>
<height>311</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="pixmap">
<pixmap resource="rsrc.qrc">:/res/ui/guiscrcpy_logo.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>15</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="stat">
<property name="font">
<font>
<family>Titillium Web</family>
<pointsize>30</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>guiscrcpy</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Initializing</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="rsrc.qrc"/>
</resources>
<connections/>
</ui>
4 changes: 2 additions & 2 deletions guiscrcpy/ui/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,5 @@ def retranslateUi(self, ToolbarPanel):
"ToolbarPanel", "Pinch out in the screen"))
self.potraitUI.setToolTip(_translate("ToolbarPanel", "Potrait"))
self.landscapeUI.setToolTip(_translate("ToolbarPanel", "Landscape"))
self.label.setText(_translate("ToolbarPanel", "...."))
self.label_2.setText(_translate("ToolbarPanel", "...."))
self.label.setText(_translate("ToolbarPanel", "::::"))
self.label_2.setText(_translate("ToolbarPanel", "::::"))
59 changes: 59 additions & 0 deletions guiscrcpy/ux/initializer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
GUISCRCPY by srevinsaju
Get it on : https://github.com/srevinsaju/guiscrcpy
Licensed under GNU Public License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

from PyQt5 import QtCore
from PyQt5.QtCore import QPoint
from PyQt5.QtWidgets import QMainWindow

from guiscrcpy.lib.toolkit import UXMapper
from guiscrcpy.ui.panel import Ui_HorizontalPanel


class Panel(QMainWindow, Ui_HorizontalPanel):
# there was a Dialog in the bracket
def __init__(self):
QMainWindow.__init__(self)
Ui_HorizontalPanel.__init__(self)
self.setupUi(self)
self.oldpos = self.pos()
self.setWindowFlags(
QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint
)

def init(self):
self.ux = UXMapper()
self.backk.clicked.connect(self.ux.key_back)
self.menuUII.clicked.connect(self.ux.key_menu)
self.homee.clicked.connect(self.ux.key_home)
self.powerUII.clicked.connect(self.ux.key_power)
self.vupp.clicked.connect(self.ux.key_volume_up)
self.vdownn.clicked.connect(self.ux.key_volume_down)
self.show()

def mousePressEvent(self, event):
self.oldPos = event.globalPos()

def mouseMoveEvent(self, event):
try:
delta = QPoint(event.globalPos() - self.oldPos)

self.move(self.x() + delta.x(), self.y() + delta.y())
self.oldPos = event.globalPos()
except (TypeError, AttributeError):
pass
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def gen_version():
packages=['guiscrcpy'],
url="https://srevinsaju.github.io/guiscrcpy",
download_url="https://github.com/srevinsaju/guiscrcpy/archive/master.zip",
package_data={'guiscrcpy': ['*', '*.*', 'resources/*', 'ui/*', 'lib/*', 'platform/*', 'theme/*', 'ux/*', 'network/*', 'settings/*'],
package_data={'guiscrcpy': ['*', '*.*', 'resources/*', 'ui/*', 'lib/*', 'platform/*', 'theme/*', 'ux/*', 'network/*', 'settings/*', 'install/*'],
'.': [".git/info/*"]
},
include_package_data=True,
Expand Down