Skip to content

Commit

Permalink
Performance update 1.2.0: Updated listing widgets for Device List & F…
Browse files Browse the repository at this point in the history
…ile List. Changed with QListView[with QAbstractListModel, QStyledItemDelegate], was QScrollArea with QWidgets
  • Loading branch information
Aldeshov committed Mar 20, 2022
1 parent 97ff904 commit 6ebb8db
Show file tree
Hide file tree
Showing 17 changed files with 544 additions and 559 deletions.
17 changes: 17 additions & 0 deletions res/styles/device-list.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
QListView {
outline: 0;
background-color: #FAFAFA;
}

QListView::item{
background-color: #E6E6E6;
}

QListView::item:hover{
background-color: #D6D6D6;
}

QListView::item:active:selected{
color: black;
background-color: #C1C1C1;
}
22 changes: 22 additions & 0 deletions res/styles/file-list.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
QListView {
outline: 0;
background-color: #FAFAFA;
}

QListView::item{
background-color: #E6E6E6;
}

QListView::item:hover{
background-color: #D6D6D6;
}

QListView::item:active:selected{
color: black;
background-color: #C1C1C1;
border: 1px solid #666666;
}

QListView::item:active:!selected{
border: 1px solid #AAAAAA;
}
2 changes: 1 addition & 1 deletion res/styles/window.qss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
QWidget {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: url("-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif");
}
3 changes: 2 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from core.configurations import Resources
from core.main import Adb
from gui.window import MainWindow
from helpers.tools import read_string_from_file

if __name__ == '__main__':
adb = Adb()
Expand All @@ -30,7 +31,7 @@
app = QApplication(sys.argv)

window = MainWindow()
window.setStyleSheet(Resources.read_string_from_file(Resources.style_window))
window.setStyleSheet(read_string_from_file(Resources.style_window))
window.show()

sys.exit(app.exec_())
18 changes: 3 additions & 15 deletions src/core/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@
import pathlib
import platform

from PyQt5.QtCore import QFile, QIODevice, QTextStream

from data.models import Device
from helpers.tools import Singleton


class Application:
__version__ = '1.1.0'
__version__ = '1.2.0'
__metaclass__ = Singleton

def __init__(self):
print(Application.NOTICE)

NOTICE = f"""\033[0;32m
ADB File Explorer v{__version__} Copyright (C) 2022 Azat Aldeshov
Platform {platform.platform()}
Expand Down Expand Up @@ -71,6 +66,8 @@ class Resources:
path = os.path.join(Application.PATH, 'res')

style_window = os.path.join(path, 'styles', 'window.qss')
style_file_list = os.path.join(path, 'styles', 'file-list.qss')
style_device_list = os.path.join(path, 'styles', 'device-list.qss')
style_notification_button = os.path.join(path, 'styles', 'notification-button.qss')

icon_logo = os.path.join(path, 'icons', 'logo.svg')
Expand All @@ -93,12 +90,3 @@ class Resources:
icon_folder_create = os.path.join(path, 'icons', 'files', 'actions', 'folder_create.svg')

anim_loading = os.path.join(path, 'anim', 'loading.gif')

@staticmethod
def read_string_from_file(path: str):
file = QFile(path)
if file.open(QIODevice.ReadOnly | QIODevice.Text):
text = QTextStream(file).readAll()
file.close()
return text
return ''
15 changes: 0 additions & 15 deletions src/gui/abstract/__init__.py

This file was deleted.

205 changes: 0 additions & 205 deletions src/gui/abstract/base.py

This file was deleted.

37 changes: 37 additions & 0 deletions src/gui/explorer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,40 @@
#
# 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.QtWidgets import QWidget, QVBoxLayout

from core.main import Adb
from core.managers import Global
from gui.explorer.devices import DeviceExplorerWidget
from gui.explorer.files import FileExplorerWidget


class MainExplorer(QWidget):
def __init__(self, parent=None):
super(MainExplorer, self).__init__(parent)
self.body = QWidget(self)
self.setLayout(QVBoxLayout(self))

Global().communicate.files.connect(self.files)
Global().communicate.devices.connect(self.devices)

def files(self):
self.clear()

self.body = FileExplorerWidget(self)
self.layout().addWidget(self.body)
self.body.update()

def devices(self):
self.clear()
Adb.manager().clear_device()

self.body = DeviceExplorerWidget(self)
self.layout().addWidget(self.body)
self.body.update()

def clear(self):
self.layout().removeWidget(self.body)
self.body.close()
self.body.deleteLater()
Loading

0 comments on commit 6ebb8db

Please sign in to comment.