-
Notifications
You must be signed in to change notification settings - Fork 16
/
ubuntu-kylin-software-center.py
5435 lines (4890 loc) · 253 KB
/
ubuntu-kylin-software-center.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python3
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang<[email protected]>
# maclin <[email protected]>
# Maintainer:
# Shine Huang<[email protected]>
# maclin <[email protected]>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
import dbus
import dbus.service
import webbrowser
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import QtGui
from xdg import BaseDirectory as xdg
from ui.mainwindow import Ui_MainWindow
# from ui.advertisement import Adversettest
from ui.categorybar import CategoryBar
from ui.rcmdcard import RcmdCard
from ui.normalcard import NormalCard
from ui.wincard import WinCard, WinGather, DataModel
from ui.cardwidget import CardWidget
from ui.pointcard import PointCard
from ui.listitemwidget import ListItemWidget
from ui.translistitemwidget import TransListItemWidget#ZX 2015.01.30
from ui.tasklistitemwidget import TaskListItemWidget
#from ui.taskwidget import Taskwidget
from ui.ranklistitemwidget import RankListItemWidget
#from ui.adwidget import *
from ui.detailscrollwidget import DetailScrollWidget
from ui.loadingdiv import *
from ui.messagebox import MessageBox
from ui.confirmdialog import ConfirmDialog, TipsDialog, Update_Source_Dialog,File_window
from ui.confwidget import ConfigWidget
from ui.login import Login
from ui.pointoutwidget import PointOutWidget
from ui.singleprocessbar import SingleProcessBar
from models.enums import (AD_BUTTON_STYLE,UBUNTUKYLIN_RES_AD_PATH,KYDROID_STARTAPP_ENV,UBUNTUKYLIN_CACHE_UKSCDB_PATH,System_software,SOFTWARE_BLACK)
from backend.search import *
from backend.service.appmanager import AppManager
from backend.installbackend import InstallBackend, InstallWatchdog
from backend.utildbus import UtilDbus
#from backend.ubuntusso import get_ubuntu_sso_backend
from backend.service.save_password import password_write, password_read
from models.enums import (UBUNTUKYLIN_RES_PATH, AppActions, AptActionMsg, PageStates, PkgStates)
from models.enums import Signals, KYDROID_VERSION,KYDROID_SOURCE_SERVER,UBUNTUKYLIN_CACHE_SETADS_PATH
from models.globals import Globals
from models.http import HttpDownLoad, unzip_resource
from models.apkinfo import ApkInfo
from apt.debfile import DebPackage
from utils import run
from utils.commontools import *
#from utils import log
import threading, time, signal
import socket
import sys
import pwd
from kydroid.kydroid_service import KydroidService
import requests
import platform
socket.setdefaulttimeout(5)
from dbus.mainloop.glib import DBusGMainLoop
mainloop = DBusGMainLoop(set_as_default=True)
import configparser
import sqlite3
import math
import subprocess
from concurrent.futures import ThreadPoolExecutor
import fcntl
import gettext
import linecache
import json
import syslog
from ui.taskwidget import Taskwidget
LOCALE = os.getenv("LANG")
if "bo" in LOCALE:
gettext.bindtextdomain("ubuntu-kylin-software-center", "/usr/share/locale-langpack")
gettext.textdomain("kylin-software-center")
else:
gettext.bindtextdomain("ubuntu-kylin-software-center", "/usr/share/locale")
gettext.textdomain("ubuntu-kylin-software-center")
_ = gettext.gettext
#log.init_logger()
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s:%(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
filename=os.path.join(xdg.xdg_cache_home, "uksc/.uksc.log"),
filemode='w'
)
LOG = logging.getLogger("uksc")
APP_PATH=0
pool = ThreadPoolExecutor(max_workers=4)
class initThread(QThread,Signals):
def __init__(self):
super(initThread, self).__init__()
def run(self):
# init dbus backend
self.watchdog = InstallWatchdog()
self.backend = InstallBackend()
self.appmgr = AppManager(self.backend)
self.watchdog.init_wathcdog_dbus()
res = self.backend.init_dbus_ifaces()
self.myinit_emit.emit(res)
#
self.sleep(1)
class AD_Thread(QThread,Signals):
def __init__(self):
super(AD_Thread, self).__init__()
def run(self):
self.myads_icon.emit()
# class MY_Thread(QThread,Signals):
# def __init__(self,app,parent):
# super(MY_Thread, self).__init__()
# self.parent=parent
# self.app=app
#
# def run(self):
# self.parent.earn_crenshoots(self.app)
# QThread.exec(self)
#
#
# class Dowload_Thread(QThread,Signals):2
# def __init__(self,app,parent):
# super(Dowload_Thread, self).__init__()
# self.parent=parent
# self.app=app
# # self.backend = InstallBackend()
# # self.appmgr = AppManager(self.backend)
#
#
# def run(self):
# self.parent.upload_appname(self.app)
# class Ask_server(QThread,Signals):
# def __init__(self,app):
# super(Ask_server, self).__init__()
# self.backend = InstallBackend()
# self.appmgr = AppManager(self.backend)
# self.app=app
#
# def run(self):
# self.appmgr.submit_downloadcount(self.app)
class SoftwareCenter(QMainWindow,Signals):
# recommend number in function "fill"
recommendNumber = 0
first_start = True
# pre page
# prePage = ''
# now
# nowPage = ''
# his page
# hisPage = ''
# search delay timer
searchDTimer = ''
# fx(name, taskitem) map
stmap = {}
# drag window x,y
dragPosition = -1
# pressed resize corner
resizeFlag = False
# init flags
win_exists = 0
ua_exists = 0
task_number = 0
list_number = 0
category = ""
add_list = ""
add_text = ""
#force_update = 0
re_page = ""
re_cli = 0
up_num = "0"
# movie timer
adlist = ["","",""]
adi = 1
adlabel = ["","",""]
lockads = True
adm = 0
bdm = 0
rec_ready = False
Globals.apkpagefirst = True
list=[]
setout = 0
config = configparser.ConfigParser()
def __init__(self, parent=None):
QMainWindow.__init__(self,parent)
self.setWindowOpacity(0)
#self.setProperty("blurRegion",QRegion(QRect(0,0,1,1)))
self.check_singleton()
# userlog = os.getlogin()
# uid = pwd.getpwuid(os.getuid())[0]
# if(uid != userlog):
# self.move((QApplication.desktop().screenGeometry(0).width()-self.width())/2,(QApplication.desktop().screenGeometry(0).height()-self.height())/2)
# QMessageBox.information(self, "软件商店启动权限异常", "请用当前系统用户权限启动软件商店!",QMessageBox.Ok)
# sys.exit(0)
self.launchLoadingDiv = LoadingDiv(None)
self.launchLoadingDiv.start_loading()
self.worker_thread0 = initThread()
# self.worker_thread0.setDaemon(True)
self.worker_thread0.start()
#def myinit(self):
self.auto_l = False
# singleton check
self.flag=0
password_read()
self.worker_thread0.myinit_emit.connect(self.slot_init)
# data init
# self.ads_ready = False
self.rec_ready = False
self.worker_thread_ad = AD_Thread()
# self.worker_thread_ad.setDaemon(True)
# self.worker_thread_ad.myads_icon.connect(self.recursion_advertisement)
# self.rank_ready = False
self.setWindowOpacity(1)
def slot_init(self, res):
#syslog.syslog(syslog.LOG_DEBUG,"software-center 111111111111")
if res == False:
# button=QMessageBox.question(self,"初始化提示",
# self.tr("检测到Dbus服务初始化失败,软件商店将无法正常使用,请重启软件商店\n"),
# QMessageBox.Retry|QMessageBox.Ignore|QMessageBox.Cancel, QMessageBox.Cancel)
box = QMessageBox(QMessageBox.Warning, _("Abnormal prompt"),
self.tr(_("DBUS service exception is detected, which may be caused by the initial exception of apt module and poor network condition.\n"
"Please exit and restart the software store.\n")), QMessageBox.NoButton, self)
yes_btn = box.addButton(self.tr(_("Yes")), QMessageBox.NoRole)
box.exec_()
if box.clickedButton() == yes_btn:
LOG.warning("dbus service init failed, you choose to exit.\n\n")
sys.exit(0)
#button=QMessageBox.warning(self,_("Abnormal prompt"),
# self.tr(_("DBUS service exception is detected, which may be caused by the initial exception of apt module and poor network condition.\n"
# "Please exit and restart the software store.\n")),
# QMessageBox.Yes, QMessageBox.Yes)
# if button == QMessageBox.Retry:
# res = self.worker_thread0.backend.init_dbus_ifaces()
# elif button == QMessageBox.Ignore:
# LOG.warning("failed to connecting dbus service, you still choose to continue...")
# break
#if button == QMessageBox.Yes:
# LOG.warning("dbus service init failed, you choose to exit.\n\n")
# sys.exit(0)
#init main view
self.init_main_view()
# init main service
self.init_main_service()
# check ukid
self.check_user()
# check apt source and update it
self.check_source()
# check has kydroid
self.kydroid_service = KydroidService()
if Globals.DADET == True:
self.ui.btnUp.setGeometry(QtCore.QRect(0, 220, 110, 110))
self.ui.btnUp_num.setGeometry(QtCore.QRect(65, 248, 16, 15))
self.ui.btnUn.setGeometry(QtCore.QRect(0, 330, 110, 110))
self.ui.btnApk.hide()
self.kydroid_service.check_has_kydroid()
self.worker_thread0.appmgr.kydroid_service = self.kydroid_service
self.worker_thread0.backend.dbus_apt_process.connect(self.slot_status_change)
self.worker_thread_ad.start()
#
#函数:启动后主界面初始化
#Function: Initialize the main interface after startup
#
def init_main_view(self):
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.centralwidget.paintEvent = self.set_paintEvent
# self.adv = AdverTisement(self.ui.adWidget)
# self.srv=Adversettest(self.ui.adWidget)
# do not cover the launch loading div
self.resize(0,0)
#self.setWindowTitle(_("银河麒麟软件商店"))
self.setWindowTitle(_("Galaxy Kylin Software Store"))
self.setWindowFlags(Qt.FramelessWindowHint)
# init components
#self.ui.adWidget.lower()
#self.ui.adWidget.raise_()
# category bar
self.categoryBar = CategoryBar(self.ui.specialcategoryWidget)
self.categoryBar.setGeometry(208, 0, 850, 22)
Globals.BLACKLIST=self.software_center_noshow()
self.dowload_widget = Taskwidget(self)
# self.dowload_widget.move(0,0)
#self.Taskwidget = Taskwidget(self.ui.taskWidget)
# self.ui.taskWidget.setStyleSheet(".QWidget{background-color:#f5f5f5;border:1px solid #cccccc;border-radius:6px;}")
# point out widget
self.pointout = PointOutWidget(self)
self.pointListWidget = CardWidget(200, 115, 4, self.pointout.ui.contentliw)
self.pointListWidget.setGeometry(0, 0, 512 + 6 + int((20 - 6) / 2), 260)
self.pointListWidget.calculate_data()
# recommend card widget
self.recommendListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.recommendWidget)
self.recommendListWidget.setGeometry(0, 223, 849, 361)
self.recommendListWidget.calculate_data()
# self.recommendListWidget.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.recommendListWidget.setWindowFlags(Qt.FramelessWindowHint)
# self.recommendListWidget.setStyleSheet("QWidget{border:1px solid red;}")
# all card widget
self.allListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.allWidget)
self.allListWidget.setGeometry(0, 0, 830 + 6 + int((20 - 6) / 2), 585) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.allListWidget.calculate_data()
# apk card widget
self.apkListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.apkWidget)
self.apkListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 580) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.apkListWidget.calculate_data()
# up card widget
self.upListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.upWidget)
self.upListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 580) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.upListWidget.calculate_data()
# un card widget
self.unListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.unWidget)
self.unListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 580) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.unListWidget.calculate_data()
# search card widget
self.searchListWidget = CardWidget(Globals.NORMALCARD_WIDTH, Globals.NORMALCARD_HEIGHT, 10, self.ui.searchWidget)
self.searchListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 580) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.searchListWidget.calculate_data()
# user applist widget
self.userAppListWidget = CardWidget(830, 88, 5, self.ui.userAppListWidget)
self.userAppListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 520) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.userAppListWidget.calculate_data()
#user translateapplist widget zx 2015.01.30
self.userTransAppListWidget = CardWidget(830, 88, 5, self.ui.userTransListWidget)
self.userTransAppListWidget.setGeometry(0, 30, 830 + 6 + int((20 - 6) / 2), 580) # 6 + (20 - 6) / 2 is verticalscrollbar space
self.userTransAppListWidget.calculate_data()
# win card widget
self.winListWidget = CardWidget(410, 115, 6, self.ui.winpageWidget)
self.winListWidget.setGeometry(0, 0, 830 + 6 + int((20 - 6) / 2), 585)
self.winListWidget.calculate_data()
# loading div
# self.launchLoadingDiv = LoadingDiv(None)
self.loadingDiv = LoadingDiv(self)
# self.topratedload = MiniLoadingDiv(self.ui.rankView, self.ui.rankView)
self.userload = MiniLoadingDiv(self.ui.beforeLoginWidget, self.ui.beforeLoginWidget)
self.apkpageload = MiniLoadingDiv(self.ui.apkWidget, self.ui.apkWidget,-5,-75)
# self.launchLoadingDiv.start_loading()
# alert message box
self.messageBox = MessageBox(self)
# detail page
self.detailScrollWidget = DetailScrollWidget(self.messageBox,self)
self.detailScrollWidget.setGeometry(0, 0, self.ui.detailShellWidget.width(), self.ui.detailShellWidget.height())
# first update process bar
self.updateSinglePB = SingleProcessBar(self.launchLoadingDiv.loadinggif)
#login
self.login = Login(self)
self.login.task_stop.connect(self.slot_click_stop)
#log in/out
self.login.messageBox = MessageBox(self)
# config widget
self.closeEvent =self._closeEvent
self.configWidget = ConfigWidget(self)
#self.configWidget.messageBox = MessageBox(self)
self.configWidget.click_update_source.connect(self.slot_click_update_source)
self.configWidget.task_cancel.connect(self.slot_click_cancel)
self.login.find_password.connect(self.configWidget.slot_show_ui)
self.login.show_config.connect(self.configwidget_btnclose)
self.login.login_sucess_goto_star.connect(self.detailScrollWidget.get_user_ratings_cat)
# resize corner
# self.resizeCorner = QPushButton(self.ui.centralwidget)
# self.resizeCorner.resize(15, 15)
# self.resizeCorner.installEventFilter(self)
# search trigger
self.searchDTimer = QTimer(self)
self.searchDTimer.timeout.connect(self.slot_searchDTimer_timeout)
# style by code
self.ui.centralwidget.setAutoFillBackground(True)
palette = QPalette()
# palette.setColor(QPalette.Background, QColor(234, 240, 243))
palette.setColor(QPalette.Background, QColor(238, 237, 240))
self.ui.centralwidget.setPalette(palette)
# self.ui.rankWidget.setAutoFillBackground(True)
# palette = QPalette()
# palette.setColor(QPalette.Background, QColor(234, 240, 243))
# palette.setColor(QPalette.Background, QColor(238, 237, 240))
# self.ui.rankWidget.setPalette(palette)
self.dowload_widget.setAutoFillBackground(True)
palette = QPalette()
palette.setColor(QPalette.Background, QColor(234, 240, 243))
self.dowload_widget.setPalette(palette)
self.ui.detailShellWidget.setAutoFillBackground(True)
palette = QPalette()
palette.setColor(QPalette.Background, QColor(238, 237, 240))
self.ui.detailShellWidget.setPalette(palette)
shadowe = QGraphicsDropShadowEffect(self)
shadowe.setOffset(5, 5) # direction & length
shadowe.setColor(Qt.gray)
shadowe.setBlurRadius(15) # blur
self.dowload_widget.setGraphicsEffect(shadowe)
self.ui.btnLogin.setFocusPolicy(Qt.NoFocus)
self.ui.btnReg.setFocusPolicy(Qt.NoFocus)
# self.ui.btnAppList.setFocusPolicy(Qt.NoFocus)
# self.ui.btnLogout.setFocusPolicy(Qt.NoFocus)
self.ui.btnClose.setFocusPolicy(Qt.NoFocus)
self.ui.btnMin.setFocusPolicy(Qt.NoFocus)
self.ui.btnMax.setFocusPolicy(Qt.NoFocus)
self.ui.btnNormal.setFocusPolicy(Qt.NoFocus)
self.ui.btnConf.setFocusPolicy(Qt.NoFocus)
# self.ui.headercw1.lebg.setFocusPolicy(Qt.NoFocus)
self.ui.btnHomepage.setFocusPolicy(Qt.NoFocus)
self.ui.btnAll.setFocusPolicy(Qt.NoFocus)
self.ui.btnAllsoftware.setFocusPolicy(Qt.NoFocus)
self.ui.btnApk.setFocusPolicy(Qt.NoFocus)
self.ui.btnUp.setFocusPolicy(Qt.NoFocus)
self.ui.btnUp_num.setFocusPolicy(Qt.NoFocus)
self.ui.btnUn.setFocusPolicy(Qt.NoFocus)
self.ui.btnWin.setFocusPolicy(Qt.NoFocus)
#self.ui.btnTask.setFocusPolicy(Qt.NoFocus)
self.ui.btnTask3.setFocusPolicy(Qt.NoFocus)
self.ui.logo_butn.setFocusPolicy(Qt.NoFocus)
#self.ui.taskListWidget.show()
# self.ui.taskListWidget_complete.setFocusPolicy(Qt.NoFocus)
# self.ui.rankView.setFocusPolicy(Qt.NoFocus)
self.ui.cbSelectAll.setFocusPolicy(Qt.NoFocus)
self.ui.btnInstallAll.setFocusPolicy(Qt.NoFocus)
# self.resizeCorner.setFocusPolicy(Qt.NoFocus)
# self.ui.btnTransList.setFocusPolicy(Qt.NoFocus)#zx 2015.01.30
# add by kobe
# self.ui.virtuallabel.setFocusPolicy(Qt.NoFocus)
self.ui.btnCloseDetail.setFocusPolicy(Qt.NoFocus)
self.ui.btnCloseDetail.clicked.connect(self.slot_close_detail)
self.ui.btnCloseDetail.setStyleSheet("QPushButton{background-image:url('res/btn-back-default.png');border:0px;}QPushButton:hover{background:url('res/btn-back-hover.png');}QPushButton:pressed{background:url('res/btn-back-pressed.png');}")
# self.ui.virtuallabel.setStyleSheet("QLabel{background-image:url('res/virtual-bg.png')}")
#add
self.ui.btnClosesearch.setFocusPolicy(Qt.NoFocus)
self.ui.hometext1.setFocusPolicy(Qt.NoFocus)
self.ui.hometext8.setFocusPolicy(Qt.NoFocus)
self.ui.hometext9.setFocusPolicy(Qt.NoFocus)
self.ui.btnClosesearch.clicked.connect(self.slot_close_search)
self.ui.btnClosesearch.setStyleSheet("QPushButton{background-image:url('res/btn-back-default.png');border:0px;}QPushButton:hover{background:url('res/btn-back-hover.png');}QPushButton:pressed{background:url('res/btn-back-pressed.png');}")
# self.ui.headercw1.leSearch.stackUnder(self.ui.headercw1.lebg)
self.ui.detailShellWidget.raise_()
self.dowload_widget.raise_()
# self.ui.taskWidget.mousePressEvent=self.taskwidget_pressevent
# self.ui.taskWidget.mouseMoveEvent=self.taskwidget_moveevent
# self.ui.virtuallabel.raise_()
# self.resizeCorner.raise_()
# self.ui.rankView.setCursor(Qt.PointingHandCursor)
# self.ui.rankView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# self.ui.rankView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
#self.ui.btnLogin.setText(_("登录"))
self.ui.btnLogin.setText(_("Login"))
#self.ui.btnReg.setText("去注册")
# self.ui.welcometext.setText("欢迎您")
#self.ui.btnAppList.setText(_("安装历史"))
self.ui.btnAppList.setText(_("Installation History"))
#self.ui.btnTransList.setText(_("我翻译的软件"))#zx.2015.01.30
self.ui.btnTransList.setText(_("My Translationed Software")) # zx.2015.01.30
#self.ui.btnLogout.setText(_("退出"))
self.ui.btnLogout.setText(_("Quit"))
#self.ui.hometext1.setText(_("推荐软件"))
self.ui.hometext1.setText(_("Rcd soft"))
#self.ui.hometext8.setText(_("必备软件"))
self.ui.hometext8.setText(_("Preq soft"))
#self.ui.hometext9.setText(_("游戏娱乐"))
self.ui.hometext9.setText(_("Game ent"))
#self.ui.hometext2.setText("评分排行")
# self.ui.hometext2.setText("热门排行")
# self.ui.headercw1.leSearch.setPlaceholderText("请输入您要搜索的软件")
# style by qss
# self.ui.hometext3.setText("共有")
# self.ui.hometext3.setAlignment(Qt.AlignLeft)
# self.ui.hometext4.setAlignment(Qt.AlignLeft)
# self.ui.homecount.setAlignment(Qt.AlignCenter)
# self.ui.hometext4.setText("款软件")
# self.ui.hometext3.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.hometext4.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.homecount.setStyleSheet("QLabel{color:#FA7053;font-size:14px;}")
self.ui.headercw1.senior_search.setView(QListView())
#self.items =[_("全局"),_("精选")]
self.items = [_("ALL"), _("Chc")]
self.ui.headercw1.senior_search.addItems(self.items)
# self.ui.headercw1.senior_search.addItem("高级",1)
self.ui.headercw1.senior_search.setCurrentIndex(1)
# self.ui.headercw1.senior_search.maxVisibleitems()
self.ui.headercw1.senior_search.currentIndexChanged.connect(self.show_red_search)
# self.ui.headercw1.senior_search.highlighted(24)
# self.ui.headercw1.senior_search.currentIndexChanged.connect(self.hide_red_search)
# print("7456456456",self.test)
# self.ui.alltext1.setText("共有")
# self.ui.alltext1.setAlignment(Qt.AlignLeft)
# self.ui.alltext2.setAlignment(Qt.AlignLeft)
# self.ui.allcount.setAlignment(Qt.AlignCenter)
# self.ui.alltext2.setText("款软件")
# # self.ui.allline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
# self.ui.alltext1.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.alltext2.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.allcount.setStyleSheet("QLabel{color:#FA7053;font-size:14px;}")
#self.ui.apktext1.setText("有")
self.ui.apktext1.setText(_("Ha"))
self.ui.apktext1.setAlignment(Qt.AlignLeft)
#self.ui.apktext2.setText("款安卓软件")
self.ui.apktext2.setText(_("Android Software"))
self.ui.apktext2.setAlignment(Qt.AlignLeft)
self.ui.apkcount.setAlignment(Qt.AlignCenter)
# self.ui.apkline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.apktext1.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.apktext2.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.apkcount.setStyleSheet("QLabel{color:#2d8ae1;font-size:13px;}")
#self.ui.uptext1.setText("有")
self.ui.uptext1.setText(_("Ha"))
self.ui.uptext1.setAlignment(Qt.AlignLeft)
self.ui.uptext2.setAlignment(Qt.AlignLeft)
self.ui.upcount.setAlignment(Qt.AlignCenter)
#self.ui.uptext2.setText("款软件可以升级")
self.ui.uptext2.setText(_("Soft can upgr"))
# self.ui.upline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.uptext1.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.uptext2.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.upcount.setStyleSheet("QLabel{color:#2d8ae1;font-size:13px;}")
#self.ui.untext1.setText("已经安装了")
self.ui.untext1.setText(_("Aldy Install"))
self.ui.untext1.setAlignment(Qt.AlignLeft)
self.ui.untext2.setAlignment(Qt.AlignLeft)
self.ui.uncount.setAlignment(Qt.AlignCenter)
#self.ui.untext2.setText("款软件")
self.ui.untext2.setText(_("Soft"))
# self.ui.unline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.untext1.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.untext2.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.uncount.setStyleSheet("QLabel{color:#2d8ae1;font-size:13px;}")
#self.ui.searchtext1.setText("搜索到")
self.ui.searchtext1.setText(_("Search"))
self.ui.searchtext1.setAlignment(Qt.AlignLeft)
self.ui.searchtext2.setAlignment(Qt.AlignLeft)
self.ui.searchcount.setAlignment(Qt.AlignCenter)
# self.ui.searchtext2.setText("款软件")
self.ui.searchtext2.setText(_("Soft"))
# self.ui.searchline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.searchtext1.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.searchtext2.setStyleSheet("QLabel{color:#666666;font-size:12px;}")
self.ui.searchcount.setStyleSheet("QLabel{color:#2d8ae1;font-size:13px;}")
#self.ui.uatitle.setText("云端保存的安装历史")
self.ui.uatitle.setText(_("Cloud Saved Installation History"))
#self.ui.btnInstallAll.setText("一键安装")
self.ui.btnInstallAll.setText(_("A Key Installation"))
#self.ui.uaNoItemText.setText("您登录后安装的软件会被记录在这里,目前暂无记录")
self.ui.uaNoItemText.setText(_("The software installed after you log in will be recorded here, there is no record at this time "))
self.ui.uaNoItemText.setAlignment(Qt.AlignCenter)
self.ui.uaNoItemText.setStyleSheet("QLabel{color:#0F84BC;font-size:16px;}")
self.ui.uaNoItemWidget.setStyleSheet("QWidget{background-image:url('res/uanoitem.png');}")
self.ui.ualine.setStyleSheet("QLabel{background-color:#e5e5e5;}")
self.ui.uatitle.setStyleSheet("QLabel{color:#777777;font-size:14px;}")
self.ui.cbSelectAll.setStyleSheet("QCheckBox{color:#666666;font-size:13px;}QCheckBox:hover{background-color:rgb(238, 237, 240);}")
self.ui.btnInstallAll.setStyleSheet("QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}")
#self.ui.transtitle.setText("云端保存的翻译历史")#zx 2015.01.30
self.ui.transtitle.setText(_("cloud saved Translation history "))
#self.ui.btnInstallAll.setText("一键安装")
#self.ui.NoTransItemText.setText("您登录后翻译的软件会被记录在这里,目前暂无记录")
self.ui.NoTransItemText.setText(_(" The software translated after you log in will be recorded here, there is no record at this time "))
self.ui.NoTransItemText.setAlignment(Qt.AlignCenter)
self.ui.NoTransItemText.setStyleSheet("QLabel{color:#0F84BC;font-size:16px;}")
self.ui.NoTransItemWidget.setStyleSheet("QWidget{background-image:url('res/uanoitem.png');}")
# self.ui.transline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.transtitle.setStyleSheet("QLabel{color:#777777;font-size:14px;}")
# self.ui.cbSelectAll.setStyleSheet("QCheckBox{color:#666666;font-size:13px;}QCheckBox:hover{background-color:rgb(238, 237, 240);}")
# self.ui.btnInstallAll.setStyleSheet("QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}")
# self.ui.wintitle.setText("Windows常用软件替换")
# self.ui.winlabel1.setText("可替换")
# self.ui.winlabel1.setAlignment(Qt.AlignLeft)
# self.ui.winlabel2.setAlignment(Qt.AlignLeft)
# self.ui.wincountlabel.setAlignment(Qt.AlignCenter)
# self.ui.winlabel2.setText("款软件")
# self.ui.winline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
# self.ui.wintitle.setStyleSheet("QLabel{color:#777777;font-size:14px;}")
# self.ui.winlabel1.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.winlabel2.setStyleSheet("QLabel{color:#666666;font-size:13px;}")
# self.ui.wincountlabel.setStyleSheet("QLabel{color:#FA7053;font-size:14px;}")
self.ui.leftbtn.setFocusPolicy(Qt.NoFocus)
self.ui.rightbtn.setFocusPolicy(Qt.NoFocus)
self.list = []
self.test = []
self.uk_ads=[]
self.ads_sate=0
self.setff=''
self.advercat=''
sctnum_ads = self.worker_thread0.appmgr.db.get_advertisement()
for it in sctnum_ads:
self.test.append(it[1])
self.list.append(it[2])
temp_list=[]
for i in self.list:
if not os.path.exists( xdg.xdg_cache_home + "/"+i):
temp_list.append(i)
i=i.split('/')
chk=i[2].split('.')
self.uk_ads.append(chk[0])
for i in temp_list:
self.list.remove(i)
for i in self.uk_ads:
self.test.remove(i)
if self.test==[] or not os.path.exists(UBUNTUKYLIN_CACHE_SETADS_PATH) or not os.listdir(UBUNTUKYLIN_CACHE_SETADS_PATH):
self.ui.listWidget.setGeometry(0, 0,830, 180)
self.ui.rightbtn.hide()
self.ui.leftbtn.hide()
self.ui.listWidget.setStyleSheet("QWidget{background-image:url('data/ads/ad0.png');border:none;background-color:transparent;}")
self.ui.adWidget.setEnabled(False)
else:
self.advercat = self.test[0]
self.ui.adWidget.setAttribute(Qt.WA_Hover, True)
self.ui.adWidget.installEventFilter(self)
if not os.path.exists(UBUNTUKYLIN_CACHE_SETADS_PATH):
self.ui.listWidget.setGeometry(0, 0, 830, 180)
self.ui.rightbtn.hide()
self.ui.leftbtn.hide()
self.ui.listWidget.setStyleSheet("QWidget{background-image:url('data/ads/ad0.png');border:none;background-color:transparent;}")
self.ui.adWidget.setEnabled(False)
else:
self.ad_display()
# self.adWidget.clicked.connect(self.slot_emit_detail)
self.ui.adWidget.clicked.connect(self.set_ttest_ads)
self.ui.loginMenu.setStyleSheet("QMenu{border:1px solid #cccccc;background-color:#ffffff;}QMenu::item{font-size:12px;color:#000000;}QMenu::item:selected{color:#ffffff; color:#2d8ae1;}")
# self.ui.userLogo.setStyleSheet("QLabel{background-image:url('res/userlogo.png')}")
# self.ui.userLogoafter.setStyleSheet("QLabel{background-image:url('res/userlogo.png')}")
self.ui.btnLogin.setStyleSheet("QPushButton{border:0px;text-align:left;font-size:12px;color:#ffffff;}QPushButton:hover{color:#00e4ff;}")
# self.ui.btnAppList.setStyleSheet("QAction{border:0px;text-align:left;font-size:12px;color:#000000;}QAction:hover{color:#ffffff;background-color:#2d8ae1;}")
# self.ui.btnTransList.setStyleSheet("QAction{border:0px;text-align:left;font-size:12px;color:#000000;}QAction:hover{color:#ffffff;background-color:#2d8ae1;}")#zx 2015.01.30
# self.ui.btnLogout.setStyleSheet("QAction{border:0px;text-align:left;font-size:12px;color:#000000;}QAction:hover{color:#ffffff;background-color:#2d8ae1;}")
self.ui.btnReg.setStyleSheet("QPushButton{border:0px;text-align:left;font-size:14px;color:#666666;}QPushButton:hover{color:#0396DC;}")
# self.ui.welcometext.setStyleSheet("QLabel{text-align:left;font-size:14px;color:#666666;}")
self.ui.username.setStyleSheet("QToolButton{border:0px;text-align:left;font-size:12px;color:#ffffff;}QToolButton:hover{color:#00e4ff;}")
self.ui.hometext1.setStyleSheet("QPushButton{border:0px;font-size:13px;color:#0F84BC;text-align:left;}")
self.ui.hometext8.setStyleSheet("QPushButton{border:0px;font-size:13px;color:#666666;text-align:left;} QPushButton:hover{border:0px;font-size:14px;color:#0396DC;} QPushButton:pressed{border:0px;font-size:14px;color:#0F84BC;}")
self.ui.hometext9.setStyleSheet("QPushButton{border:0px;font-size:13px;color:#666666;text-align:left;} QPushButton:hover{border:0px;font-size:14px;color:#0396DC;} QPushButton:pressed{border:0px;font-size:14px;color:#0F84BC;}")
# self.ui.hometext2.setStyleSheet("QLabel{color:#777777;font-size:14px;}")
# self.ui.homeline1.setStyleSheet("QLabel{background-color:#CCCCCC;}")
# self.ui.homeline2.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.navWidget.setStyleSheet(".QWidget{background-color:#535353;border-top-left-radius:6px;border-bottom-left-radius:6px;}")
self.ui.btnAll.setStyleSheet("QPushButton{background-image:url('res/nav-all-1.png');border:0px;}QPushButton:hover{background:url('res/nav-all-2.png');}QPushButton:pressed{background:url('res/nav-all-3.png');}")
self.ui.btnApk.setStyleSheet("QPushButton{background-image:url('res/nav-apk-1.png');border:0px;}QPushButton:hover{background:url('res/nav-apk-2.png');}QPushButton:pressed{background:url('res/nav-apk-3.png');}")
self.ui.btnUp.setStyleSheet("QPushButton{background-image:url('res/nav-up-1.png');border:0px;}QPushButton:hover{background:url('res/nav-up-2.png');}QPushButton:pressed{background:url('res/nav-up-3.png');}")
self.ui.btnUn.setStyleSheet("QPushButton{background-image:url('res/nav-un-1.png');border:0px;}QPushButton:hover{background:url('res/nav-un-2.png');}QPushButton:pressed{background:url('res/nav-un-3.png');}")
self.ui.btnUp_num.setStyleSheet("QLabel{background-image:url('res/btnUp_num.png');color:white;font-size:9px;background-color:transparent;}")
self.ui.btnUp_text.setStyleSheet("QLabel{background-color:transparent;color:#ffffff;}")
# self.ui.btnUp_text.setText(" 升 级")
self.ui.btnUp_text.setText(_(" Upgrade"))
self.ui.btnAll_text.setStyleSheet("QLabel{background-color:transparent;color:#ffffff;}")
# self.ui.btnAll_text.setText(" 宝 库 ")
self.ui.btnAll_text.setText(_(" Storehouse"))
self.ui.btnApk_text.setStyleSheet("QLabel{background-color:transparent;color:#ffffff;}")
self.ui.btnApk_text.setText(_(" Cell Phone"))
# self.ui.btnApk_text.setText(" 手 机")
self.ui.btnUn_text.setStyleSheet("QLabel{background-color:transparent;color:#ffffff;}")
self.ui.btnUn_text.setText(_(" Uninstall"))
# self.ui.btnUn_text.setText(" 卸 载")
self.ui.btnHomepage.setStyleSheet("QPushButton{border:0px;font-size:12px;color:#666666;text-align:center;background-color:#f5f5f5;} QPushButton:hover{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;} QPushButton:pressed{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;}")
self.ui.btnAllsoftware.setStyleSheet("QPushButton{border:0px;font-size:12px;color:#666666;text-align:center;background-color:#f5f5f5;} QPushButton:hover{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;} QPushButton:pressed{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;}")
self.ui.btnWin.setStyleSheet("QPushButton{border:0px;font-size:12px;color:#666666;text-align:center;background-color:#f5f5f5;} QPushButton:hover{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;} QPushButton:pressed{border:0px;font-size:12px;color:#ffffff;background-color:#2d8ae1;}")
#self.ui.btnTask.setStyleSheet("QPushButton{background-image:url('res/nav-task-1.png');border:0px;}QPushButton:hover{background:url('res/nav-task-2.png');}QPushButton:pressed{background:url('res/nav-task-3.png');}")
#self.ui.btnGoto.setStyleSheet("QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}")
#self.ui.btnGoto.setText("去宝库看看")
self.ui.logoImg.setStyleSheet("QLabel{background-color:transparent;background-image:url('res/logo.png')}")
self.ui.logo_butn.setStyleSheet("QPushButton{background-color:transparent;border:0px;}")
# self.ui.logoName.setText("软件商店")
# self.ui.logoName.setStyleSheet("QLabel{color:#ffffff;font-size:14px;}")
# add by kobe
self.ui.headercw1.lebg.setStyleSheet("QPushButton{background-image:url('res/search-1.png');border:0px;}QPushButton:hover{background:url('res/search-2.png');}QPushButton:pressed{background:url('res/search-2.png');}")
self.ui.headercw1.leSearch.setStyleSheet("QLineEdit{background-color:#EEEDF0;border:1px solid #CCCCCC;color:#999999;font-size:12px;}QLineEdit:hover{background-color:#EEEDF0;border:1px solid #0396dc;color:#999999;font-size:12px;}")
self.ui.btnClose.setStyleSheet("QPushButton{background-image:url('res/close-1.png');border:0px;}QPushButton:hover{background-image:url('res/close-2.png');background-color:#c75050;}QPushButton:pressed{background-image:url('res/close-2.png');background-color:#bb3c3c;}")
self.ui.btnMin.setStyleSheet("QPushButton{background-image:url('res/min-1.png');border:0px;}QPushButton:hover{background-color:#d0d0d0;}QPushButton:pressed{background-color:#ababab;}")
self.ui.btnMax.setStyleSheet("QPushButton{background-image:url('res/max-1.png');border:0px;}QPushButton:hover{background:url('res/max-2.png');}QPushButton:pressed{background:url('res/max-3.png');}")
self.ui.btnNormal.setStyleSheet("QPushButton{background-image:url('res/normal-1.png');border:0px;}QPushButton:hover{background:url('res/normal-2.png');}QPushButton:pressed{background:url('res/normal-3.png');}")
self.ui.btnConf.setStyleSheet("QPushButton{background-image:url('res/conf-1.png');border:0px;}QPushButton:hover{background-color:#d0d0d0;}QPushButton:pressed{background-color:#ababab;}")
# self.ui.rankView.setStyleSheet("QListWidget{border:0px;background-color:#EEEDF0;}QListWidget::item{height:24px;border:0px;}QListWidget::item:hover{height:52;}")
# self.ui.taskListWidget_complete.setStyleSheet("QListWidget{background-color:#EAF0F3;border:0px;}QListWidget::item{height:64;margin-top:0px;border:0px;}")
# self.ui.taskListWidget_complete.verticalScrollBar().setStyleSheet("QScrollBar:vertical{margin:0px 0px 0px 0px;background-color:rgb(255,255,255,100);border:0px;width:6px;}\
# QScrollBar::sub-line:vertical{subcontrol-origin:margin;border:1px solid red;height:13px}\
# QScrollBar::up-arrow:vertical{subcontrol-origin:margin;background-color:blue;height:13px}\
# QScrollBar::sub-page:vertical{background-color:#EEEDF0;}\
# QScrollBar::handle:vertical{background-color:#D1D0D2;width:6px;} QScrollBar::handle:vertical:hover{background-color:#14ACF5;width:6px;} QScrollBar::handle:vertical:pressed{background-color:#0B95D7;width:6px;}\
# QScrollBar::add-page:vertical{background-color:#EEEDF0;}\
# QScrollBar::down-arrow:vertical{background-color:yellow;}\
# QScrollBar::add-line:vertical{subcontrol-origin:margin;border:1px solid green;height:13px}")
# self.ui.taskListWidget_complete.setSpacing(1)
# self.resizeCorner.setStyleSheet("QPushButton{background-image:url('res/resize-1.png');border:0px;}QPushButton:hover{background-image:url('res/resize-2.png')}QPushButton:pressed{background-image:url('res/resize-1.png')}")
# self.resizeCorner.setCursor(Qt.SizeFDiagCursor)
#self.ui.tasklabel.setStyleSheet("QLabel{color:#777777;font-size:13px;}")
#self.ui.tasklabel.setText("任务列表")
# self.ui.taskhline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
# self.ui.taskvline.setStyleSheet("QLabel{background-color:#CCCCCC;}")
self.ui.hometext1.clicked.connect(self.slot_rec_show_recommend)
self.ui.hometext8.clicked.connect(self.slot_rec_show_necessary)
self.ui.hometext9.clicked.connect(self.slot_rec_show_game)
# signal / slot
# self.ui.rankView.itemClicked.connect(self.slot_click_rank_item)
self.allListWidget.verticalScrollBar().valueChanged.connect(self.slot_softwidget_scroll_end)
self.apkListWidget.verticalScrollBar().valueChanged.connect(self.slot_softwidget_scroll_end)
self.upListWidget.verticalScrollBar().valueChanged.connect(self.slot_softwidget_scroll_end)
self.unListWidget.verticalScrollBar().valueChanged.connect(self.slot_softwidget_scroll_end)
self.searchListWidget.verticalScrollBar().valueChanged.connect(self.slot_softwidget_scroll_end)
self.allListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.upListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.unListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.searchListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.winListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.userAppListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.userTransAppListWidget.verticalScrollBar().valueChanged.connect(self.set_taskwidget_visible_false)
self.ui.btnHomepage.pressed.connect(self.slot_goto_homepage)
self.ui.btnAll.pressed.connect(self.slot_goto_homepage)
self.ui.btnAllsoftware.pressed.connect(self.slot_goto_allpage)
self.ui.btnApk.pressed.connect(self.slot_goto_apkpage)
self.ui.btnUp.pressed.connect(self.slot_goto_uppage)
self.ui.btnUn.pressed.connect(self.slot_goto_unpage)
# self.ui.btnTask.pressed.connect(self.slot_goto_taskpage)
self.ui.btnWin.pressed.connect(self.slot_goto_winpage)
self.ui.btnClose.clicked.connect(self.slot_close)
self.ui.btnMax.clicked.connect(self.slot_max)
self.ui.btnNormal.clicked.connect(self.slot_normal)
self.ui.btnMin.clicked.connect(self.slot_min)
self.ui.btnConf.clicked.connect(self.slot_show_config)
self.ui.headercw1.leSearch.textChanged.connect(self.slot_search_text_change)
self.ui.cbSelectAll.clicked.connect(self.slot_ua_select_all)
self.ui.btnInstallAll.clicked.connect(self.slot_click_ua_install_all)
#self.ui.btnGoto.pressed.connect(self.slot_goto_allpage)
self.ui.btnTask3.setIcon(QIcon('res/downlaod_defualt.png'))
self.ui.btnTask3.setIconSize(QSize(22, 22))
#self.ui.btnTask3.setText("下载管理")
self.ui.btnTask3.setText(_("DL MGT"))
self.ui.btnTask3.setStyleSheet("QToolButton{border:0px;font-size:12px;color:#2d8ae1;text-align:center;} QToolButton:hover{border:0px;font-size:13px;color:#0396DC;} QToolButton:pressed{border:0px;font-size:14px;color:#0F84BC;}")
self.ui.btnTask3.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self.ui.btnTask3.setAutoRaise(True)
self.ui.btnTask3.clicked.connect(self.slot_goto_taskpage)
# user account
#self.sso = get_ubuntu_sso_backend()
#self.ui.btnLogin.clicked.connect(self.slot_do_login_account)
#self.ui.btnReg.clicked.connect(self.slot_do_register)
self.ui.btnLogin.clicked.connect(self.slot_do_login_ui)
self.ui.logo_butn.clicked.connect(self.slot_do_login_ui)
self.configWidget.goto_login.connect(self.slot_do_login_ui)
self.ui.btnLogout.triggered.connect(self.slot_do_logout)
self.ui.btnAppList.triggered.connect(self.slot_goto_uapage)
self.ui.btnTransList.triggered.connect(self.slot_goto_translatepage)
#self.sso.connect("whoami", self.slot_whoami_done)
# add by kobe
self.ui.headercw1.lebg.clicked.connect(self.slot_searchDTimer_timeout)
self.ui.headercw1.leSearch.returnPressed.connect(self.slot_enter_key_pressed)
self.click_item.connect(self.slot_show_app_detail)
self.upgrade_app.connect(self.slot_click_upgrade)
self.update_source.connect(self.slot_update_source)
self.categoryBar.click_categoy.connect(self.slot_change_category)
# self.Taskwidget.click_task.connect(self.slot_change_task)
self.detailScrollWidget.install_debfile.connect(self.slot_click_install_debfile)
self.detailScrollWidget.install_app.connect(self.slot_click_install)
self.detailScrollWidget.upgrade_app.connect(self.slot_click_upgrade)
self.detailScrollWidget.remove_app.connect(self.slot_click_remove)
self.detailScrollWidget.submit_review.connect(self.slot_submit_review)
self.detailScrollWidget.submit_rating.connect(self.slot_submit_rating)
self.detailScrollWidget.submit_download.connect(self.slot_submit_downloadcount)
self.detailScrollWidget.goto_login.connect(self.slot_do_login_ui)
self.detailScrollWidget.free_reg.connect(self.login.slot_click_adduser)
self.detailScrollWidget.pl_login.connect(self.login.slot_click_login)
#change login
self.detailScrollWidget.show_login.connect(self.slot_do_login_ui)
#self.connect(self.detailScrollWidget, show_login, self.slot_do_login_account)
self.detailScrollWidget.submit_translate_appinfo.connect(self.slot_submit_translate_appinfo)#zx2015.01.26
self.detailScrollWidget.btns.uninstall_uksc_or_not.connect(self.slot_uninstall_uksc_or_not)
self.uninstall_uksc.connect(self.detailScrollWidget.btns.uninstall_uksc)
self.cancel_uninstall_uksc.connect(self.detailScrollWidget.btns.cancel_uninstall_uksc)
self.normalcard_progress_change.connect(self.detailScrollWidget.slot_proccess_change)
self.login.ui_adduser.connect(self.slot_ui_adduser)
self.login.ui_login.connect(self.slot_ui_login)
self.login.ui_login_success.connect(self.slot_ui_login_success)
#self.connect(self.login, ui_uksc_update, self.slot_uksc_update)
self.configWidget.change_identity.connect(self.slot_change_identity)
self.configWidget.rset_password.connect(self.slot_rset_password)
self.configWidget.recover_password.connect(self.slot_recover_password)
self.dowload_widget.ask_mainwindow.connect(self.delete_all_finished_taskwork)
self.dowload_widget.ask1_mainwindow.connect(self.slot_close_taskpage)
# self.dowload_widget.ask2_mainwindow.connect(self.slot_clear_all_task_list)
# widget status
self.ui.btnUp.setEnabled(False)
self.ui.btnUn.setEnabled(False)
# self.ui.btnTask.setEnabled(False)
self.ui.btnWin.setEnabled(False)
self.ui.btnTask3.setEnabled(False)
self.ui.btnNormal.hide()
self.ui.allWidget.hide()
self.ui.upWidget.hide()
self.ui.unWidget.hide()
self.ui.searchWidget.hide()
self.ui.userAppListWidget.hide()
self.ui.userTransListWidget.hide()#zx 2015.01.30
self.dowload_widget.hide()
self.ui.winpageWidget.hide()
self.ui.headerWidget.hide()
self.ui.centralwidget.hide()
# loading
if(Globals.LAUNCH_MODE != 'quiet'):
self.launchLoadingDiv.start_loading()
def cacnel_wait(self,appname):
self.set_cancel_wait.emit(appname)
#
#函数名:重绘窗口阴影
#Function: Redraw window shadow
#
def set_paintEvent(self, event):
painter=QPainter (self.ui.centralwidget)
m_defaultBackgroundColor = QColor(qRgb(192,192,192))
m_defaultBackgroundColor.setAlpha(50)
path=QPainterPath()
path.setFillRule(Qt.WindingFill)
path.addRoundedRect(10, 10, self.ui.centralwidget.width() - 20, self.ui.centralwidget.height() - 20, 4, 4)
painter.setRenderHint(QPainter.Antialiasing, True)
painter.fillPath(path, QBrush(QColor(m_defaultBackgroundColor.red(),
m_defaultBackgroundColor.green(),
m_defaultBackgroundColor.blue())))
color=QColor(0, 0, 0, 20)
i=0
while i<4:
path=QPainterPath()
path.setFillRule(Qt.WindingFill)
path.addRoundedRect(10 - i, 10 - i,self.ui.centralwidget.width() - (10 - i) * 2, self.ui.centralwidget.height() - (10 - i) * 2, 6, 6)
color.setAlpha(100 - int(math.sqrt(i)) * 50)
painter.setPen(color)
painter.drawPath(path)
i=i+1
painter.setRenderHint(QPainter.Antialiasing)
#
#函数名:高级搜索提示和隐藏
#Function: Advanced search show and hide
#
def show_red_search(self):
test_linedit = self.ui.headercw1.senior_search.currentText()
if test_linedit==self.items[0]:
self.ui.set_lindit.show()
Globals.ADVANCED_SEARCH=True
else:
Globals.ADVANCED_SEARCH = False
self.ui.set_lindit.hide()
#
#函数名:广告推荐界面相关
#Function: Advertising recommendation interface
#
def ad_display(self):
self.ui.leftbtn.setStyleSheet("QPushButton{background-image:url('res/ads_left1.png');border:none;background-color:transparent;}QPushButton:hover{background-image:url('res/ads_left2.png');border:none;background-color:transparent;}QPushButton:pressed{background-image:url('res/ads_left2.png');border:none;background-color:transparent;}")
self.ui.rightbtn.setStyleSheet("QPushButton{background-image:url('res/ads_right1.png');border:none;background-color:transparent;}QPushButton:hover{background-image:url('res/ads_right2.png');border:none;background-color:transparent;}QPushButton:pressed{background-image:url('res/ads_right2.png');border:none;background-color:transparent;}")
self.ui.listWidget.setStyleSheet("QPushButton{background-image:url(" + xdg.xdg_cache_home + "/" + self.list[0] + ");border:none;}")
# if not os.path.exists(UBUNTUKYLIN_CACHE_SETADS_PATH) and not os.path.exists("data/ads/"):
# self.ui.leftbtn.hide()
# self.ui.rightbtn.hide()
self.ui.listWidget.setGeometry(0, 0, (len(self.list) +2)* 830, 180)
i = 0
while i < len(self.list)+2:
if i==0:
self.ui.takeads[i].setStyleSheet("QWidget{background-image:url(" + xdg.xdg_cache_home + "/" + self.list[len(self.list)-1] + ");border:none;background-color:transparent;}")
elif i==len(self.list)+1:
self.ui.takeads[i].setStyleSheet("QWidget{background-image:url(" + xdg.xdg_cache_home + "/" + self.list[0] + ");border:none;background-color:transparent;}")
else:
self.ui.takeads[i].setStyleSheet("QWidget{background-image:url(" + xdg.xdg_cache_home + "/" + self.list[i-1] + ");border:none;background-color:transparent;}")
i = i + 1
self.ui.rightbtn.clicked.connect(self.right_btn_icon)
self.ui.leftbtn.clicked.connect(self.left_btn_icon)
self.testnum = 0
self.adtimer = QTimer(self)
self.timernum = QTimer(self)
self.left_adstimer=QTimer(self)
self.adtimer.timeout.connect(self.recursion_advertisement)
self.adtimer.stop()
self.left_adstimer.timeout.connect(self.left_advertisement)
self.adtimer.start(5)
self.timernum.timeout.connect(self.wbtest)
self.timernum.start(2000)
# self.ui.adWidget.setMouseTracking(True)
self.ui.listWidget.setMouseTracking(True)