Skip to content

Commit 41cc359

Browse files
Added Gpu logo to Vulkan screen, still WIP for Prime systemes
1 parent ce59b25 commit 41cc359

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

About GPU Viewer

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Copyright (C) 2017-2018 Arun Sivaraman <arunsivaramanneo@gmail.com>
2+
Copyright (C) 2017-2019 Arun Sivaraman <arunsivaramanneo@gmail.com>
33

44
GPU Viewer is a free Software: This program comes with absolutely no WARRANTY. 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. Click on the GPLv3 Icon below to view the License
55

Files/Common.py

+16
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ def fetchImageFromUrl(imgUrl, iconWidth, iconHeight, aspectRatio):
6464
return GdkPixbuf.Pixbuf.new_from_file_at_scale(
6565
filename=imgUrl, width=iconWidth, height=iconHeight, preserve_aspect_ratio=aspectRatio)
6666

67+
def setGpuIcon():
68+
69+
with open("/tmp/gpu-viewer/VKDDeviceinfo1.txt", "r") as file1:
70+
for line in file1:
71+
if "Intel" in line:
72+
gpu_image = fetchImageFromUrl(Const.INTEL_LOGO_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, True)
73+
74+
break
75+
elif "NVIDIA" in line or "GeForce" in line :
76+
gpu_image = fetchImageFromUrl(Const.NVIDIA_LOGO_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, True)
77+
break
78+
elif "AMD" in line or "ATI" in line:
79+
gpu_image = fetchImageFromUrl(Const.AMD_LOGO_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, True)
80+
break
81+
image_render = Gtk.Image.set_from_pixbuf(gpu_image)
82+
return image_renderer
6783

6884
# Copy the Contents of the file from a File to a List
6985
def copyContentsFromFile(fileName):

Files/Const.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@
7676
"srgb", "aux", "depth", "stcl",
7777
"acr", "acg", "acb", "aca", "msnum", "msbufs", "caveats"]
7878

79-
ICON_WIDTH = 120
79+
ICON_WIDTH = 125
8080

8181
ICON_HEIGHT = 50
8282

8383
ICON_HEIGHT2 = 50
8484

85-
WIDTH_RATIO = 0.70
85+
WIDTH_RATIO = 0.72
8686

87-
WIDTH_RATIO2 = 0.65
87+
WIDTH_RATIO2 = 0.70
8888

8989
HEIGHT_RATIO1 = 0.92
9090

Files/VulkanViewer.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import threading
88

99
gi.require_version("Gtk", "3.0")
10-
from gi.repository import Gtk, Gdk
10+
from gi.repository import Gtk, Gdk,GdkPixbuf
1111
# noinspection PyPep8
1212
from Common import copyContentsFromFile, setBackgroundColor, setColumns, createSubTab, createScrollbar, createSubFrame, \
13-
colorTrueFalse, getDriverVersion, getVulkanVersion, getDeviceSize, refresh_filter, getRamInGb
13+
colorTrueFalse, getDriverVersion, getVulkanVersion, getDeviceSize, refresh_filter, getRamInGb, fetchImageFromUrl, setGpuIcon
1414

1515
MWIDTH = 300
1616

@@ -647,6 +647,9 @@ def searchInstanceLayersTree(model, iter, Tree):
647647
def radcall(combo):
648648

649649
text = combo.get_active()
650+
gpu_image = GdkPixbuf.Pixbuf.new_from_file_at_size(self.Cover, 250, 250)
651+
image_renderer = Gtk.Image.new_from_pixbuf(self.image)
652+
650653
for i in range(len(list)):
651654
if text == i:
652655
Devices(text)
@@ -659,7 +662,9 @@ def radcall(combo):
659662
MemoryTypes(text)
660663
Queues(text)
661664
Surface(text)
665+
gpu_image=setGpuIcon(self)
662666
Instance()
667+
DevicesGrid.attach(gpu_image,50,1,1,1)
663668

664669
# os.system("rm /tmp/gpu-viewer/VKD*.txt")
665670

@@ -1089,6 +1094,7 @@ def selectFeature(Combo):
10891094
list = [i.strip('\n ') for i in list]
10901095

10911096
DS = Gtk.Label()
1097+
gpu_image = Gtk.Image()
10921098
DS.set_text("Available Device(s) :")
10931099
DevicesGrid.attach(DS, 0, 1, 1, 1)
10941100
gpu_store = Gtk.ListStore(str)
@@ -1104,6 +1110,9 @@ def selectFeature(Combo):
11041110
gpu_combo.set_entry_text_column(0)
11051111
gpu_combo.set_active(0)
11061112

1113+
1114+
1115+
11071116
DevicesGrid.attach_next_to(gpu_combo, DS, Gtk.PositionType.RIGHT, 20, 1)
11081117

11091118
# Logos

Images/nvidia-logo.png

100755100644
43.8 KB
Loading

0 commit comments

Comments
 (0)