ubuntu-kylin-software-center-0.2.9.2/ 0000775 0000000 0000000 00000000000 12322543236 014330 5 ustar ubuntu-kylin-software-center-0.2.9.2/ubuntu-kylin-software-center.svg 0000664 0000000 0000000 00000076255 12321543450 022641 0 ustar
]>
ubuntu-kylin-software-center-0.2.9.2/ui/ 0000775 0000000 0000000 00000000000 12322543237 014746 5 ustar ubuntu-kylin-software-center-0.2.9.2/ui/taskw.py 0000664 0000000 0000000 00000003257 12321543450 016454 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'taskw.ui'
#
# Created: Fri Mar 7 11:17:18 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_TaskWidget(object):
def setupUi(self, TaskWidget):
TaskWidget.setObjectName(_fromUtf8("TaskWidget"))
TaskWidget.resize(805, 479)
self.taskHeader = QtGui.QLabel(TaskWidget)
self.taskHeader.setGeometry(QtCore.QRect(0, 55, 805, 24))
self.taskHeader.setText(_fromUtf8(""))
self.taskHeader.setObjectName(_fromUtf8("taskHeader"))
self.taskListWidget = QtGui.QListWidget(TaskWidget)
self.taskListWidget.setGeometry(QtCore.QRect(0, 79, 805, 400))
self.taskListWidget.setObjectName(_fromUtf8("taskListWidget"))
self.taskMSGBar = QtGui.QLabel(TaskWidget)
self.taskMSGBar.setGeometry(QtCore.QRect(0, 0, 805, 55))
self.taskMSGBar.setText(_fromUtf8(""))
self.taskMSGBar.setObjectName(_fromUtf8("taskMSGBar"))
self.retranslateUi(TaskWidget)
QtCore.QMetaObject.connectSlotsByName(TaskWidget)
def retranslateUi(self, TaskWidget):
TaskWidget.setWindowTitle(_translate("TaskWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/__init__.py 0000664 0000000 0000000 00000001530 12321543450 017052 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 . ubuntu-kylin-software-center-0.2.9.2/ui/confw.ui 0000664 0000000 0000000 00000010345 12321543450 016420 0 ustar
ConfigWidget
0
0
561
345
Form
15
45
120
293
134
45
414
293
0
25
413
205
10
268
90
20
10
233
90
20
107
268
90
20
335
268
60
20
10
4
80
17
87
12
326
1
110
233
285
20
210
268
120
20
15
268
220
17
0
0
194
17
24
202
-1
18
18
0
0
561
345
bg
pageListWidget
sourceWidget
ubuntu-kylin-software-center-0.2.9.2/ui/confw.py 0000664 0000000 0000000 00000010357 12321543450 016436 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'confw.ui'
#
# Created: Wed Apr 2 09:48:53 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_ConfigWidget(object):
def setupUi(self, ConfigWidget):
ConfigWidget.setObjectName(_fromUtf8("ConfigWidget"))
ConfigWidget.resize(561, 345)
self.pageListWidget = QtGui.QListWidget(ConfigWidget)
self.pageListWidget.setGeometry(QtCore.QRect(15, 45, 120, 293))
self.pageListWidget.setObjectName(_fromUtf8("pageListWidget"))
self.sourceWidget = QtGui.QWidget(ConfigWidget)
self.sourceWidget.setGeometry(QtCore.QRect(134, 45, 414, 293))
self.sourceWidget.setObjectName(_fromUtf8("sourceWidget"))
self.sourceListWidget = QtGui.QListWidget(self.sourceWidget)
self.sourceListWidget.setGeometry(QtCore.QRect(0, 25, 413, 205))
self.sourceListWidget.setObjectName(_fromUtf8("sourceListWidget"))
self.btnUpdate = QtGui.QPushButton(self.sourceWidget)
self.btnUpdate.setGeometry(QtCore.QRect(10, 268, 90, 20))
self.btnUpdate.setText(_fromUtf8(""))
self.btnUpdate.setObjectName(_fromUtf8("btnUpdate"))
self.btnAdd = QtGui.QPushButton(self.sourceWidget)
self.btnAdd.setGeometry(QtCore.QRect(10, 233, 90, 20))
self.btnAdd.setText(_fromUtf8(""))
self.btnAdd.setObjectName(_fromUtf8("btnAdd"))
self.btnReset = QtGui.QPushButton(self.sourceWidget)
self.btnReset.setGeometry(QtCore.QRect(107, 268, 90, 20))
self.btnReset.setText(_fromUtf8(""))
self.btnReset.setObjectName(_fromUtf8("btnReset"))
self.btnClose = QtGui.QPushButton(self.sourceWidget)
self.btnClose.setGeometry(QtCore.QRect(335, 268, 60, 20))
self.btnClose.setText(_fromUtf8(""))
self.btnClose.setObjectName(_fromUtf8("btnClose"))
self.text1 = QtGui.QLabel(self.sourceWidget)
self.text1.setGeometry(QtCore.QRect(10, 4, 80, 17))
self.text1.setText(_fromUtf8(""))
self.text1.setObjectName(_fromUtf8("text1"))
self.line1 = QtGui.QLabel(self.sourceWidget)
self.line1.setGeometry(QtCore.QRect(87, 12, 326, 1))
self.line1.setText(_fromUtf8(""))
self.line1.setObjectName(_fromUtf8("line1"))
self.lesource = QtGui.QLineEdit(self.sourceWidget)
self.lesource.setGeometry(QtCore.QRect(110, 233, 285, 20))
self.lesource.setObjectName(_fromUtf8("lesource"))
self.cbhideubuntu = QtGui.QCheckBox(self.sourceWidget)
self.cbhideubuntu.setGeometry(QtCore.QRect(210, 268, 120, 20))
self.cbhideubuntu.setText(_fromUtf8(""))
self.cbhideubuntu.setObjectName(_fromUtf8("cbhideubuntu"))
self.processwidget = QtGui.QWidget(self.sourceWidget)
self.processwidget.setGeometry(QtCore.QRect(15, 268, 220, 17))
self.processwidget.setObjectName(_fromUtf8("processwidget"))
self.progressBar = QtGui.QProgressBar(self.processwidget)
self.progressBar.setGeometry(QtCore.QRect(0, 0, 194, 17))
self.progressBar.setProperty("value", 24)
self.progressBar.setObjectName(_fromUtf8("progressBar"))
self.btnCancel = QtGui.QPushButton(self.processwidget)
self.btnCancel.setGeometry(QtCore.QRect(202, -1, 18, 18))
self.btnCancel.setText(_fromUtf8(""))
self.btnCancel.setObjectName(_fromUtf8("btnCancel"))
self.bg = QtGui.QLabel(ConfigWidget)
self.bg.setGeometry(QtCore.QRect(0, 0, 561, 345))
self.bg.setText(_fromUtf8(""))
self.bg.setObjectName(_fromUtf8("bg"))
self.retranslateUi(ConfigWidget)
QtCore.QMetaObject.connectSlotsByName(ConfigWidget)
def retranslateUi(self, ConfigWidget):
ConfigWidget.setWindowTitle(_translate("ConfigWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/ukcmtw.py 0000664 0000000 0000000 00000004232 12321543450 016627 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ukcmtw.ui'
#
# Created: Wed Mar 12 09:52:10 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_CommentWidget(object):
def setupUi(self, CommentWidget):
CommentWidget.setObjectName(_fromUtf8("CommentWidget"))
CommentWidget.resize(815, 85)
self.userHead = QtGui.QLabel(CommentWidget)
self.userHead.setGeometry(QtCore.QRect(20, 10, 61, 61))
self.userHead.setText(_fromUtf8(""))
self.userHead.setObjectName(_fromUtf8("userHead"))
self.userName = QtGui.QLabel(CommentWidget)
self.userName.setGeometry(QtCore.QRect(95, 10, 130, 17))
self.userName.setText(_fromUtf8(""))
self.userName.setObjectName(_fromUtf8("userName"))
self.commentBG = QtGui.QLabel(CommentWidget)
self.commentBG.setGeometry(QtCore.QRect(85, 30, 708, 39))
self.commentBG.setText(_fromUtf8(""))
self.commentBG.setObjectName(_fromUtf8("commentBG"))
self.comment = QtGui.QLabel(CommentWidget)
self.comment.setGeometry(QtCore.QRect(100, 33, 600, 34))
self.comment.setText(_fromUtf8(""))
self.comment.setObjectName(_fromUtf8("comment"))
self.createDate = QtGui.QLabel(CommentWidget)
self.createDate.setGeometry(QtCore.QRect(235, 10, 160, 17))
self.createDate.setText(_fromUtf8(""))
self.createDate.setObjectName(_fromUtf8("createDate"))
self.retranslateUi(CommentWidget)
QtCore.QMetaObject.connectSlotsByName(CommentWidget)
def retranslateUi(self, CommentWidget):
CommentWidget.setWindowTitle(_translate("CommentWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/ukrliw.py 0000664 0000000 0000000 00000003311 12321543450 016627 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ukrliw.ui'
#
# Created: Tue Mar 11 15:16:29 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_RankListWidget(object):
def setupUi(self, RankListWidget):
RankListWidget.setObjectName(_fromUtf8("RankListWidget"))
RankListWidget.resize(133, 20)
self.name = QtGui.QLabel(RankListWidget)
self.name.setGeometry(QtCore.QRect(32, 1, 133, 18))
self.name.setText(_fromUtf8(""))
self.name.setObjectName(_fromUtf8("name"))
self.iconbg = QtGui.QLabel(RankListWidget)
self.iconbg.setGeometry(QtCore.QRect(10, 3, 14, 14))
self.iconbg.setText(_fromUtf8(""))
self.iconbg.setObjectName(_fromUtf8("iconbg"))
self.iconnumber = QtGui.QLabel(RankListWidget)
self.iconnumber.setGeometry(QtCore.QRect(11, 4, 12, 12))
self.iconnumber.setText(_fromUtf8(""))
self.iconnumber.setObjectName(_fromUtf8("iconnumber"))
self.retranslateUi(RankListWidget)
QtCore.QMetaObject.connectSlotsByName(RankListWidget)
def retranslateUi(self, RankListWidget):
RankListWidget.setWindowTitle(_translate("RankListWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/tasklistitemwidget.py 0000664 0000000 0000000 00000010004 12321543450 021230 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
import os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.uktliw import Ui_TaskLIWidget
from models.enums import Signals,AptActionMsg
from models.enums import UBUNTUKYLIN_RES_TMPICON_PATH
class TaskListItemWidget(QWidget):
app = ''
finish = False
def __init__(self, app, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.app = app
self.parent = parent
self.ui.size.setAlignment(Qt.AlignCenter)
self.ui.btnCancel.setFocusPolicy(Qt.NoFocus)
self.ui.status.setAlignment(Qt.AlignTop)
self.ui.status.setWordWrap(True)
self.ui.name.setStyleSheet("QLabel{font-size:14px;font-weight:bold;}")
self.ui.btnCancel.setStyleSheet("QPushButton{background-image:url('res/cancel.png');border:0px;}")
self.ui.progressBar.setStyleSheet("QProgressBar{background-image:url('res/progressbg.png');border:0px;border-radius:0px;text-align:center;color:#1E66A4;}"
"QProgressBar:chunk{background-image:url('res/progress1.png');}")
self.ui.btnCancel.clicked.connect(self.slot_click_cancel)
self.connect(self.parent,Signals.apt_process_finish,self.slot_work_finished)
img = ''
if(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".png")):
img = QPixmap("data/tmpicons/" + app.name + ".png")
elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".jpg")):
img = QPixmap("data/tmpicons/" + app.name + ".jpg")
else:
img = QPixmap("data/tmpicons/default.jpg")
img = img.scaled(32, 32)
self.ui.icon.setPixmap(img)
self.ui.name.setText(app.name)
size = app.packageSize
sizek = size / 1024
self.ui.size.setText(str(sizek) + " K")
self.ui.progressBar.setRange(0,100)
self.ui.progressBar.reset()
self.ui.status.setText("等待中......")
def ui_init(self):
self.ui = Ui_TaskLIWidget()
self.ui.setupUi(self)
self.show()
def status_change(self, processtype, percent, msg):
text = ''
if(processtype == 'fetch'):
text = "正在下载: "
if percent >= 100:
#text = "下载完成,开始安装..."
self.ui.progressBar.reset()
self.ui.status.setText("下载完成,开始安装...")
return
else:
self.ui.progressBar.setValue(percent)
elif(processtype == 'apt'):
text = "正在执行: "
if percent >= 100:
text = "安装完成"
self.ui.progressBar.setValue(percent)
else:
self.ui.progressBar.setValue(percent)
self.ui.status.setText(msg)
def slot_work_finished(self, pkgname, action):
if self.app.name == pkgname:
self.ui.progressBar.setValue(100)
self.ui.status.setText(AptActionMsg[action]+"已经完成")
self.finish = True
def slot_click_cancel(self):
if(self.finish == True):
self.emit(Signals.task_remove, self.app)
else:
self.emit(Signals.task_cancel, self.app.name) ubuntu-kylin-software-center-0.2.9.2/ui/recommenditem.py 0000664 0000000 0000000 00000014006 12321543450 020145 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# maclin
# 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 .
import os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.ukrcmdw import Ui_UKrcmdw
from utils import run
from models.enums import (ITEM_LABEL_STYLE,
UBUNTUKYLIN_RES_ICON_PATH,
RECOMMEND_BUTTON_BK_STYLE,
UBUNTUKYLIN_RES_PATH,
AppActions,
RECOMMEND_BUTTON_STYLE)
from models.enums import Signals
class RecommendItem(QWidget):
def __init__(self,app, mainwin, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.app = app
self.mainwin = mainwin
self.parent = parent
self.ui.btn.setFocusPolicy(Qt.NoFocus)
self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
self.ui.btnDetail.setText("详情")
self.ui.btnDetail.hide()
if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png"))
elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg"))
else:
self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + "default.png"))
# self.ui.softIcon.setStyleSheet(UBUNTUKYLIN_LABEL_STYLE_PATH % (UBUNTUKYLIN_RES_ICON_PATH+str(self.app.name)+".png"))
#self.ui.softIcon.setStyleSheet("QLabel{background-image:url('res/icons/" + str(self.app.name) + ".png')}")
self.ui.softName.setStyleSheet("QLabel{font-size:14px;font-weight:bold;}")
self.ui.softDescr.setStyleSheet("QLabel{font-size:13px;color:#7E8B97;}")
self.ui.btn.setStyleSheet(RECOMMEND_BUTTON_BK_STYLE % (UBUNTUKYLIN_RES_PATH+"btn-1.png"))
#self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;color:white;font-size:14px;background-image:url('res/btn6-1.png')}QPushButton:hover{background-image:url('res/btn6-2.png')}QPushButton:pressed{background-image:url('res/btn6-3.png')}")
self.ui.btnDetail.setStyleSheet(RECOMMEND_BUTTON_STYLE %(UBUNTUKYLIN_RES_PATH + "btn6-1.png",UBUNTUKYLIN_RES_PATH + "btn6-2.png",UBUNTUKYLIN_RES_PATH + "btn6-3.png"))
self.ui.softName.setText(self.app.name)
self.ui.softDescr.setText(self.app.summary)
if(self.app.is_installed):
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
else:
self.ui.btn.setText("安装")
self.ui.btn.clicked.connect(self.slot_btn_click)
self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
self.connect(self.mainwin,Signals.apt_process_finish,self.slot_work_finished)
self.connect(self.mainwin,Signals.apt_process_cancel,self.slot_work_cancel)
def ui_init(self):
self.ui = Ui_UKrcmdw()
self.ui.setupUi(self)
self.show()
def enterEvent(self, event):
self.ui.btnDetail.show()
# self.setAutoFillBackground(True)
# palette = QPalette()
# palette.setColor(QPalette.Background, QColor(228, 241, 248))
# self.setPalette(palette)
def leaveEvent(self, event):
self.ui.btnDetail.hide()
# self.setAutoFillBackground(True)
# palette = QPalette()
# palette.setColor(QPalette.Background, Qt.white)
# self.setPalette(palette)
def slot_btn_click(self):
if(self.ui.btn.text() == "启动"):
run.run_app(self.app.name)
else:
self.ui.btn.setEnabled(False)
self.ui.btn.setText("正在处理")
self.emit(Signals.install_app, self.app)
def slot_emit_detail(self):
self.emit(Signals.show_app_detail, self.app)
def slot_work_finished(self, pkgname,action):
if self.app.name == pkgname:
if action == AppActions.INSTALL:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
elif action == AppActions.REMOVE:
self.ui.btn.setText("安装")
elif action == AppActions.UPGRADE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
def slot_work_cancel(self, pkgname,action):
if self.app.name == pkgname:
if action == AppActions.INSTALL:
self.ui.btn.setText("安装")
elif action == AppActions.REMOVE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
elif action == AppActions.UPGRADE:
self.ui.btn.setText("升级")
ubuntu-kylin-software-center-0.2.9.2/ui/mainwindow.ui 0000664 0000000 0000000 00000040076 12321543450 017464 0 ustar
MainWindow
0
0
907
620
MainWindow
46
113
152
479
0
163
152
316
0
0
152
133
0
0
152
133
0
161
152
2
0
133
152
28
软件分类
198
113
663
479
0
214
529
265
530
214
133
265
8
10
16
16
27
11
45
16
排行榜
74
10
14
15
92
10
14
15
110
10
14
15
3
34
65
28
下载排行
66
34
65
28
评分排行
0
62
133
203
529
214
1
265
40
592
827
28
12
4
18
18
37
3
140
19
182
3
70
19
198
113
663
479
0
79
663
400
0
55
663
24
0
0
663
55
198
113
663
479
0
79
663
400
0
55
663
24
0
0
663
55
198
113
663
479
0
79
663
400
0
55
663
24
0
0
663
55
6
113
56
134
6
268
40
90
6
247
40
21
6
277
40
21
6
307
40
21
6
337
40
21
0
0
907
141
70
28
41
41
126
28
41
41
221
30
77
34
319
30
77
34
419
30
77
34
667
21
159
56
515
30
113
34
670
91
154
20
675
96
10
10
198
113
663
479
0
79
663
400
0
55
663
24
0
0
663
55
46
113
815
479
0
55
815
24
0
0
815
55
0
79
815
400
40
113
6
479
861
113
6
479
ubuntu-kylin-software-center-0.2.9.2/ui/confirmdialog.py 0000664 0000000 0000000 00000005712 12321543450 020136 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from models.enums import UBUNTUKYLIN_RES_PATH
class ConfirmDialog(QDialog):
def __init__(self, text, parent=None):
QDialog.__init__(self,parent)
self.setWindowFlags(Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
# self.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog)
self.setGeometry(0, 0, 907, 620)
# self.resize(200, 100)
# self.setAutoFillBackground(True)
# palette = QPalette()
# img = QPixmap(UBUNTUKYLIN_RES_PATH + "alert.png")
# palette.setBrush(QPalette.Window, QBrush(img))
# self.setPalette(palette)
self.centerwidget = QWidget(self)
self.centerwidget.setGeometry(328, 237, 251, 146)
self.centerwidget.setAutoFillBackground(True)
palette = QPalette()
img = QPixmap(UBUNTUKYLIN_RES_PATH + "confirmdialog.png")
palette.setBrush(QPalette.Window, QBrush(img))
self.centerwidget.setPalette(palette)
self.text = QLabel(self.centerwidget)
self.text.setText(text)
self.text.setGeometry(25, 65, 200, 25)
self.text.setAlignment(Qt.AlignCenter)
self.text.setStyleSheet("QLabel{font-size:14px;}")
self.btnok = QPushButton(self.centerwidget)
self.btnok.setText("确定")
self.btnok.setGeometry(50, 100, 64, 22)
self.btnok.clicked.connect(self.slot_ok)
self.btnok.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/btn4-1.png')}QPushButton:hover{background-image:url('res/btn4-2.png')}QPushButton:pressed{background-image:url('res/btn4-3.png')}")
self.btncancel = QPushButton(self.centerwidget)
self.btncancel.setText("取消")
self.btncancel.setGeometry(137, 100, 64, 22)
self.btncancel.clicked.connect(self.slot_cancel)
self.btncancel.setStyleSheet("QPushButton{border:0px;background-image:url('res/btn-notenable.png')}")
self.raise_()
def slot_ok(self):
self.emit(SIGNAL("confirmdialogok"))
self.close()
def slot_cancel(self):
self.close() ubuntu-kylin-software-center-0.2.9.2/ui/uksw.py 0000664 0000000 0000000 00000004011 12321543450 016301 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'uksw.ui'
#
# Created: Mon Mar 10 10:08:03 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_StarWidget(object):
def setupUi(self, StarWidget):
StarWidget.setObjectName(_fromUtf8("StarWidget"))
StarWidget.resize(64, 16)
self.star1 = QtGui.QLabel(StarWidget)
self.star1.setGeometry(QtCore.QRect(1, 1, 10, 10))
self.star1.setText(_fromUtf8(""))
self.star1.setObjectName(_fromUtf8("star1"))
self.star2 = QtGui.QLabel(StarWidget)
self.star2.setGeometry(QtCore.QRect(14, 1, 10, 10))
self.star2.setText(_fromUtf8(""))
self.star2.setObjectName(_fromUtf8("star2"))
self.star3 = QtGui.QLabel(StarWidget)
self.star3.setGeometry(QtCore.QRect(27, 1, 10, 10))
self.star3.setText(_fromUtf8(""))
self.star3.setObjectName(_fromUtf8("star3"))
self.star4 = QtGui.QLabel(StarWidget)
self.star4.setGeometry(QtCore.QRect(40, 1, 10, 10))
self.star4.setText(_fromUtf8(""))
self.star4.setObjectName(_fromUtf8("star4"))
self.star5 = QtGui.QLabel(StarWidget)
self.star5.setGeometry(QtCore.QRect(53, 1, 10, 10))
self.star5.setText(_fromUtf8(""))
self.star5.setObjectName(_fromUtf8("star5"))
self.retranslateUi(StarWidget)
QtCore.QMetaObject.connectSlotsByName(StarWidget)
def retranslateUi(self, StarWidget):
StarWidget.setWindowTitle(_translate("StarWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/ukrliw.ui 0000664 0000000 0000000 00000002176 12321543450 016624 0 ustar
RankListWidget
0
0
133
20
Form
32
1
66
18
10
3
14
14
11
4
12
12
ubuntu-kylin-software-center-0.2.9.2/ui/configwidget.py 0000664 0000000 0000000 00000023534 12321543450 017774 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.confw import Ui_ConfigWidget
from models.enums import Signals
class ConfigWidget(QWidget):
sourcelist = ''
iscanceled = ''
def __init__(self, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.backend = parent.backend
self.setWindowFlags(Qt.FramelessWindowHint)
self.ui.bg.lower()
self.move(173, 138)
palette = QPalette()
brush = QBrush(QColor(0, 0, 0, 0))
brush.setStyle(Qt.SolidPattern)
palette.setBrush(QPalette.All, QPalette.Base, brush)
self.ui.pageListWidget.setPalette(palette)
self.ui.sourceWidget.setPalette(palette)
self.ui.sourceListWidget.setPalette(palette)
self.ui.pageListWidget.setFocusPolicy(Qt.NoFocus)
self.ui.sourceListWidget.setFocusPolicy(Qt.NoFocus)
self.ui.btnUpdate.setFocusPolicy(Qt.NoFocus)
self.ui.btnAdd.setFocusPolicy(Qt.NoFocus)
self.ui.btnReset.setFocusPolicy(Qt.NoFocus)
self.ui.btnClose.setFocusPolicy(Qt.NoFocus)
self.ui.cbhideubuntu.setFocusPolicy(Qt.NoFocus)
self.ui.btnCancel.setFocusPolicy(Qt.NoFocus)
self.ui.btnClose.clicked.connect(self.hide)
self.ui.btnUpdate.clicked.connect(self.slot_click_update)
self.ui.btnAdd.clicked.connect(self.slot_click_add)
self.ui.lesource.textChanged.connect(self.slot_le_input)
self.ui.cbhideubuntu.stateChanged.connect(self.slot_checkstate_changed)
self.ui.btnCancel.clicked.connect(self.slot_click_cancel)
self.ui.text1.setText("软件源列表")
self.ui.cbhideubuntu.setText("隐藏ubuntu源")
self.ui.btnUpdate.setText(" 更新软件源")
self.ui.btnAdd.setText(" 添加软件源")
self.ui.btnReset.setText("恢复默认设置")
self.ui.btnClose.setText("关闭")
sourceitem = QListWidgetItem("软件源设置")
sourceitem.setIcon(QIcon("res/source.png"))
self.ui.pageListWidget.addItem(sourceitem)
self.ui.bg.setStyleSheet("QLabel{background-image:url('res/configwidget.png');}")
self.ui.text1.setStyleSheet("QLabel{color:#1E66A4;font-size:14px;}")
self.ui.line1.setStyleSheet("QLabel{background-color:#E0E0E0;}")
self.ui.pageListWidget.setStyleSheet("QListWidget{border:0px;}QListWidget::item{height:25px;padding-left:5px;margin-top:0px;border:0px;}QListWidget::item:selected{background-color:#6BB8DD;color:#E6F1F7;}")
self.ui.sourceWidget.setStyleSheet("QListWidget{border:0px;}")
self.ui.sourceListWidget.setStyleSheet("QListWidget{border:0px;}QListWidget::item{height:25px;margin-top:0px;margin-left:1px;border:0px;}QListWidget::item:selected{background-color:#E4F1F8;;}")
self.ui.lesource.setStyleSheet("QLineEdit{border:1px solid #6BB8DD;border-radius:1px;color:#497FAB;font-size:13px;}")
self.ui.btnUpdate.setStyleSheet("QPushButton{border:0px;color:#1E66A4;font-size:14px;background:url('res/btnupdate.png') no-repeat;}")
self.ui.btnAdd.setStyleSheet("QPushButton{border:0px;color:gray;font-size:14px;background:url('res/btnadd.png') no-repeat;}")
self.ui.btnReset.setStyleSheet("QPushButton{border:0px;color:gray;font-size:14px;}")
self.ui.btnClose.setStyleSheet("QPushButton{border:0px;color:#1E66A4;font-size:14px;background:url('res/btn2-1.png');}QPushButton:hover{background:url('res/btn2-2.png');}QPushButton:pressed{background:url('res/btn2-3.png');}")
self.ui.cbhideubuntu.setStyleSheet("QCheckBox{border:0px;color:#1E66A4;font-size:14px;}")
self.ui.btnCancel.setStyleSheet("QPushButton{background-image:url('res/cancel.png');border:0px;}")
self.ui.progressBar.setStyleSheet("QProgressBar{background-image:url('res/progressbg.png');border:0px;border-radius:0px;text-align:center;color:#1E66A4;}"
"QProgressBar:chunk{background-image:url('res/progress2.png');}")
self.ui.sourceListWidget.verticalScrollBar().setStyleSheet("QScrollBar:vertical{width:11px;background-color:black;margin:0px,0px,0px,0px;padding-top:0px;padding-bottom:0px;}"
"QScrollBar:sub-page:vertical{background:qlineargradient(x1: 0.5, y1: 1, x2: 0.5, y2: 0, stop: 0 #D4DCE1, stop: 1 white);}QScrollBar:add-page:vertical{background:qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #D4DCE1, stop: 1 white);}"
"QScrollBar:handle:vertical{background:qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #CACACA, stop: 1 #818486);}QScrollBar:add-line:vertical{background-color:green;}")
self.ui.pageListWidget.setItemSelected(self.ui.pageListWidget.item(0), True)
self.ui.btnAdd.setEnabled(False)
self.ui.btnReset.setEnabled(False)
self.ui.cbhideubuntu.setChecked(True)
self.set_process_visiable(False)
self.ui.progressBar.setRange(0,100)
self.ui.progressBar.reset()
self.hide()
def ui_init(self):
self.ui = Ui_ConfigWidget()
self.ui.setupUi(self)
self.show()
def fill_sourcelist(self):
self.ui.sourceListWidget.clear()
slist = self.backend.get_sources(self.ui.cbhideubuntu.isChecked())
for one in slist:
item = QListWidgetItem()
itemw = SourceItemWidget(one, self)
self.ui.sourceListWidget.addItem(item)
self.ui.sourceListWidget.setItemWidget(item, itemw)
def set_process_visiable(self, flag):
if(flag == True):
self.ui.processwidget.setVisible(True)
self.ui.btnUpdate.setVisible(False)
self.ui.btnReset.setVisible(False)
self.ui.cbhideubuntu.setVisible(False)
else:
self.ui.processwidget.setVisible(False)
self.ui.btnUpdate.setVisible(True)
self.ui.btnReset.setVisible(True)
self.ui.cbhideubuntu.setVisible(True)
def slot_click_cancel(self):
self.iscanceled = True
self.emit(Signals.task_cancel, "#update")
def slot_click_update(self):
self.iscanceled = False
self.ui.progressBar.reset()
self.set_process_visiable(True)
self.emit(Signals.click_update_source)
def slot_update_status_change(self, percent):
self.ui.progressBar.setValue(percent)
def slot_update_finish(self):
self.set_process_visiable(False)
def slot_click_add(self):
sourcetext = str(self.ui.lesource.text().toUtf8())
self.backend.add_source(sourcetext)
self.fill_sourcelist()
def slot_le_input(self, text):
sourcetext = str(text.toUtf8())
if(sourcetext.strip() == ""):
self.ui.btnAdd.setStyleSheet("QPushButton{border:0px;color:gray;font-size:14px;background:url('res/btnadd.png') no-repeat;}")
self.ui.btnAdd.setEnabled(False)
else:
self.ui.btnAdd.setStyleSheet("QPushButton{border:0px;color:#1E66A4;font-size:14px;background:url('res/btnadd.png') no-repeat;}")
self.ui.btnAdd.setEnabled(True)
def slot_checkstate_changed(self):
self.fill_sourcelist()
class SourceItemWidget(QWidget):
confw = ''
type = ''
def __init__(self, source, parent=None):
QWidget.__init__(self,parent)
self.confw = parent
self.resize(414, 25)
self.sourcetype = QLabel(self)
self.sourcetype.setGeometry(10, 4, 8, 17)
self.sourcetext = QLabel(self)
self.sourcetext.setGeometry(25, 4, 345, 17)
self.btnremove = QPushButton(self)
self.btnremove.setGeometry(377, 4, 18, 18)
self.btnremove.clicked.connect(self.slot_remove_source)
self.btnremove.setFocusPolicy(Qt.NoFocus)
self.sourcetype.setStyleSheet("QLabel{font-size:13px;color:#1E66A4;}")
self.sourcetext.setStyleSheet("QLabel{font-size:13px;color:#5E5B67;}")
self.btnremove.setStyleSheet("QPushButton{border:0px;background-image:url('res/cancel.png');}")
slist = source.split()
self.type = slist[0]
typestr = ''
if(self.type == "deb"):
typestr = "D"
if(self.type == "deb-src"):
typestr = "S"
self.sourcetype.setText(typestr)
compstr = " "
for i in range(3, len(slist)):
compstr += slist[i]
compstr += " "
compstr = compstr[:-1]
text = str(slist[1]) + " " + str(slist[2]) + compstr
self.sourcetext.setText(text)
def slot_remove_source(self):
source = str(self.type) + " " + str(self.sourcetext.text().toUtf8())
self.confw.sourcelist.remove_source(source)
self.confw.fill_sourcelist()
def main():
import sys
app = QApplication(sys.argv)
QTextCodec.setCodecForTr(QTextCodec.codecForName("UTF-8"))
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
globalfont = QFont()
globalfont.setFamily("文泉驿微米黑")
app.setFont(globalfont)
a = ConfigWidget()
a.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main() ubuntu-kylin-software-center-0.2.9.2/ui/uksw.ui 0000664 0000000 0000000 00000003145 12321543450 016275 0 ustar
StarWidget
0
0
64
16
Form
1
1
10
10
14
1
10
10
27
1
10
10
40
1
10
10
53
1
10
10
ubuntu-kylin-software-center-0.2.9.2/ui/ukcmtw.ui 0000664 0000000 0000000 00000003211 12321543450 016610 0 ustar
CommentWidget
0
0
815
85
Form
20
10
61
61
95
10
130
17
85
30
708
39
100
33
600
34
235
10
160
17
ubuntu-kylin-software-center-0.2.9.2/ui/uktliw.ui 0000664 0000000 0000000 00000003530 12321543450 016621 0 ustar
TaskLIWidget
0
0
805
45
Form
10
7
32
32
60
14
180
18
261
14
66
18
343
14
194
17
24
575
3
220
39
545
13
18
18
ubuntu-kylin-software-center-0.2.9.2/ui/listitemwidget.py 0000664 0000000 0000000 00000020357 12321543450 020361 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# maclin
# 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 .
import os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.ukliw import Ui_Ukliw
from utils import run
from models.enums import (ITEM_LABEL_STYLE,
UBUNTUKYLIN_RES_TMPICON_PATH,
UBUNTUKYLIN_RES_ICON_PATH,
LIST_BUTTON_STYLE,
UBUNTUKYLIN_RES_PATH,
RECOMMEND_BUTTON_STYLE,
AppActions,
Signals)
class ListItemWidget(QWidget):
app = ''
workType = ''
def __init__(self, app, backend, nowpage, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.app = app
self.backend = backend
self.workType = nowpage
self.parent = parent
self.ui.size.setAlignment(Qt.AlignRight)
self.ui.installedsize.setAlignment(Qt.AlignRight)
self.ui.size.setStyleSheet("QLabel{font-size:13px;}")
self.ui.installedsize.setStyleSheet("QLabel{font-size:13px;}")
self.ui.btn.setFocusPolicy(Qt.NoFocus)
self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
self.ui.btnDetail.setText("详情")
self.ui.btnDetail.hide()
if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".png"))
elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".jpg"))
elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png")):
self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png"))
elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg")):
self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg"))
else:
self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + "default.png"))
self.ui.btnDetail.setStyleSheet(RECOMMEND_BUTTON_STYLE %(UBUNTUKYLIN_RES_PATH+"btn6-1.png",UBUNTUKYLIN_RES_PATH+"btn6-2.png",UBUNTUKYLIN_RES_PATH+"btn6-3.png"))
self.ui.name.setStyleSheet("QLabel{font-size:14px;font-weight:bold;}")
self.ui.descr.setStyleSheet("QLabel{font-size:13px;color:#7E8B97;}")
self.ui.installedVersion.setStyleSheet("QLabel{font-size:13px;}")
self.ui.candidateVersion.setStyleSheet("QLabel{font-size:13px;color:#FF7D15;}")
self.ui.btn.setStyleSheet(LIST_BUTTON_STYLE % (UBUNTUKYLIN_RES_PATH+"btn-small-1.png",UBUNTUKYLIN_RES_PATH+"btn-small-2.png",UBUNTUKYLIN_RES_PATH+"btn-small-3.png") )
self.ui.name.setText(app.name)
summ = app.summary
# if len(summ) > 31:
# summ = summ[:30]
# summ += "..."
self.ui.descr.setText(summ)
size = app.packageSize
sizek = size / 1024
if(sizek < 1024):
self.ui.size.setText(str(sizek) + " KB")
else:
self.ui.size.setText(str('%.2f'%(sizek/1024.0)) + " MB")
# print "########item size:",app.name,app.packageSize,app.installedSize
installedsize = app.installedSize
installedsizek = installedsize / 1024
if(installedsizek < 1024):
self.ui.installedsize.setText(str(installedsizek) + " KB")
else:
self.ui.installedsize.setText(str('%.2f'%(installedsizek/1024.0)) + " MB")
#????放置平均得分和评论人数
# print "ListItemWidget: ", self.app.name, self.app.rnrStat
if app.rnrStat is not None:
ratings_average = app.rnrStat.ratings_average
ratings_total = app.rnrStat.ratings_total
print "评分评论:",app.name, ratings_average, ratings_total
self.ui.candidateVersion.setText("最新: " + app.candidate_version)
# self.ui.candidateVersion.setText("最新: " + software.candidate_version + "")
if(nowpage == 'homepage'):
self.ui.btn.setVisible(True)
if(app.is_installed):
self.ui.installedVersion.setText("已装: " + app.installed_version)
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
else:
self.ui.btn.setText("安装")
self.ui.installedVersion.setText("未安装")
elif(nowpage == 'uppage'):
self.ui.btn.setVisible(True)
self.ui.btn.setText("升级")
self.ui.installedVersion.setText("已装: " + app.installed_version)
elif(nowpage == 'unpage'):
self.ui.btn.setVisible(True)
self.ui.btn.setText("卸载")
self.ui.installedVersion.setText("已装: " + app.installed_version)
elif(nowpage == 'searchpage'):
self.ui.btn.setVisible(False)
self.ui.btn.clicked.connect(self.slot_btn_click)
self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
self.connect(self.parent,Signals.apt_process_finish,self.slot_work_finished)
self.connect(self.parent,Signals.apt_process_cancel,self.slot_work_cancel)
def ui_init(self):
self.ui = Ui_Ukliw()
self.ui.setupUi(self)
self.show()
def enterEvent(self, event):
self.ui.btnDetail.show()
def leaveEvent(self, event):
self.ui.btnDetail.hide()
def slot_btn_click(self):
if(self.ui.btn.text() == "启动"):
run.run_app(self.app.name)
else:
self.ui.btn.setEnabled(False)
self.ui.btn.setText("请稍候")
if(self.workType == 'homepage'):
self.emit(Signals.install_app, self.app)
elif(self.workType == 'uppage'):
self.emit(Signals.upgrade_app, self.app)
elif(self.workType == 'unpage'):
self.emit(Signals.remove_app, self.app)
def slot_emit_detail(self):
self.emit(Signals.show_app_detail, self.app)
def slot_work_finished(self, pkgname, action):
if self.app.name == pkgname:
if action == AppActions.INSTALL:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
elif action == AppActions.REMOVE:
self.ui.btn.setText("安装")
elif action == AppActions.UPGRADE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
def slot_work_cancel(self, pkgname, action):
if self.app.name == pkgname:
if action == AppActions.INSTALL:
self.ui.btn.setText("安装")
elif action == AppActions.REMOVE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btn.setText("已安装")
self.ui.btn.setEnabled(False)
else:
self.ui.btn.setText("启动")
elif action == AppActions.UPGRADE:
self.ui.btn.setText("升级") ubuntu-kylin-software-center-0.2.9.2/ui/uktliw.py 0000664 0000000 0000000 00000004413 12321543450 016635 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'uktliw.ui'
#
# Created: Wed Mar 12 16:08:45 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_TaskLIWidget(object):
def setupUi(self, TaskLIWidget):
TaskLIWidget.setObjectName(_fromUtf8("TaskLIWidget"))
TaskLIWidget.resize(805, 45)
self.icon = QtGui.QLabel(TaskLIWidget)
self.icon.setGeometry(QtCore.QRect(10, 7, 32, 32))
self.icon.setText(_fromUtf8(""))
self.icon.setObjectName(_fromUtf8("icon"))
self.name = QtGui.QLabel(TaskLIWidget)
self.name.setGeometry(QtCore.QRect(60, 14, 180, 18))
self.name.setText(_fromUtf8(""))
self.name.setObjectName(_fromUtf8("name"))
self.size = QtGui.QLabel(TaskLIWidget)
self.size.setGeometry(QtCore.QRect(261, 14, 66, 18))
self.size.setText(_fromUtf8(""))
self.size.setObjectName(_fromUtf8("size"))
self.progressBar = QtGui.QProgressBar(TaskLIWidget)
self.progressBar.setGeometry(QtCore.QRect(343, 14, 194, 17))
self.progressBar.setProperty("value", 24)
self.progressBar.setObjectName(_fromUtf8("progressBar"))
self.status = QtGui.QLabel(TaskLIWidget)
self.status.setGeometry(QtCore.QRect(575, 3, 220, 39))
self.status.setObjectName(_fromUtf8("status"))
self.btnCancel = QtGui.QPushButton(TaskLIWidget)
self.btnCancel.setGeometry(QtCore.QRect(545, 13, 18, 18))
self.btnCancel.setText(_fromUtf8(""))
self.btnCancel.setObjectName(_fromUtf8("btnCancel"))
self.retranslateUi(TaskLIWidget)
QtCore.QMetaObject.connectSlotsByName(TaskLIWidget)
def retranslateUi(self, TaskLIWidget):
TaskLIWidget.setWindowTitle(_translate("TaskLIWidget", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/ukliw.ui 0000664 0000000 0000000 00000005201 12321543450 016432 0 ustar
Ukliw
0
0
663
66
Form
10
8
48
48
65
14
201
18
65
34
205
18
282
14
71
20
593
23
47
20
368
14
120
18
368
34
120
18
14
23
40
18
282
34
71
20
ubuntu-kylin-software-center-0.2.9.2/ui/ukrcmdw.py 0000664 0000000 0000000 00000005607 12321543450 017000 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
# Form implementation generated from reading ui file 'ukrcmdw.ui'
#
# Created: Thu Mar 6 12:42:19 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_UKrcmdw(object):
def setupUi(self, UKrcmdw):
UKrcmdw.setObjectName(_fromUtf8("UKrcmdw"))
UKrcmdw.resize(176, 88)
self.btn = QtGui.QPushButton(UKrcmdw)
self.btn.setGeometry(QtCore.QRect(73, 54, 62, 20))
self.btn.setObjectName(_fromUtf8("btn"))
self.softIcon = QtGui.QLabel(UKrcmdw)
self.softIcon.setGeometry(QtCore.QRect(20, 20, 48, 48))
self.softIcon.setText(_fromUtf8(""))
self.softIcon.setObjectName(_fromUtf8("softIcon"))
self.softName = QtGui.QLabel(UKrcmdw)
self.softName.setGeometry(QtCore.QRect(73, 16, 100, 17))
self.softName.setText(_fromUtf8(""))
self.softName.setObjectName(_fromUtf8("softName"))
self.softDescr = QtGui.QLabel(UKrcmdw)
self.softDescr.setGeometry(QtCore.QRect(73, 34, 100, 17))
self.softDescr.setText(_fromUtf8(""))
self.softDescr.setObjectName(_fromUtf8("softDescr"))
self.btnDetail = QtGui.QPushButton(UKrcmdw)
self.btnDetail.setGeometry(QtCore.QRect(24, 35, 40, 18))
self.btnDetail.setText(_fromUtf8(""))
self.btnDetail.setObjectName(_fromUtf8("btnDetail"))
self.retranslateUi(UKrcmdw)
QtCore.QMetaObject.connectSlotsByName(UKrcmdw)
def retranslateUi(self, UKrcmdw):
UKrcmdw.setWindowTitle(_translate("UKrcmdw", "Form", None))
self.btn.setText(_translate("UKrcmdw", "下载", None))
ubuntu-kylin-software-center-0.2.9.2/ui/ukliw.py 0000664 0000000 0000000 00000007277 12321543450 016464 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
# Form implementation generated from reading ui file 'ukliw.ui'
#
# Created: Wed Mar 5 15:56:59 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Ukliw(object):
def setupUi(self, Ukliw):
Ukliw.setObjectName(_fromUtf8("Ukliw"))
Ukliw.resize(663, 66)
self.icon = QtGui.QLabel(Ukliw)
self.icon.setGeometry(QtCore.QRect(10, 8, 48, 48))
self.icon.setText(_fromUtf8(""))
self.icon.setObjectName(_fromUtf8("icon"))
self.name = QtGui.QLabel(Ukliw)
self.name.setGeometry(QtCore.QRect(65, 14, 201, 18))
self.name.setText(_fromUtf8(""))
self.name.setObjectName(_fromUtf8("name"))
self.descr = QtGui.QLabel(Ukliw)
self.descr.setGeometry(QtCore.QRect(65, 34, 205, 18))
self.descr.setText(_fromUtf8(""))
self.descr.setObjectName(_fromUtf8("descr"))
self.size = QtGui.QLabel(Ukliw)
self.size.setGeometry(QtCore.QRect(282, 14, 71, 20))
self.size.setText(_fromUtf8(""))
self.size.setObjectName(_fromUtf8("size"))
self.installedsize = QtGui.QLabel(Ukliw)
self.installedsize.setGeometry(QtCore.QRect(282, 34, 71, 20))
self.installedsize.setText(_fromUtf8(""))
self.installedsize.setObjectName(_fromUtf8("installedsize"))
self.btn = QtGui.QPushButton(Ukliw)
self.btn.setGeometry(QtCore.QRect(593, 23, 47, 20))
self.btn.setText(_fromUtf8(""))
self.btn.setObjectName(_fromUtf8("btn"))
self.installedVersion = QtGui.QLabel(Ukliw)
self.installedVersion.setGeometry(QtCore.QRect(368, 14, 120, 18))
self.installedVersion.setText(_fromUtf8(""))
self.installedVersion.setObjectName(_fromUtf8("installedVersion"))
self.candidateVersion = QtGui.QLabel(Ukliw)
self.candidateVersion.setGeometry(QtCore.QRect(368, 34, 120, 18))
self.candidateVersion.setText(_fromUtf8(""))
self.candidateVersion.setObjectName(_fromUtf8("candidateVersion"))
self.btnDetail = QtGui.QPushButton(Ukliw)
self.btnDetail.setGeometry(QtCore.QRect(14, 23, 40, 18))
self.btnDetail.setText(_fromUtf8(""))
self.btnDetail.setObjectName(_fromUtf8("btnDetail"))
self.retranslateUi(Ukliw)
QtCore.QMetaObject.connectSlotsByName(Ukliw)
def retranslateUi(self, Ukliw):
Ukliw.setWindowTitle(_translate("Ukliw", "Form", None))
ubuntu-kylin-software-center-0.2.9.2/ui/detailw.ui 0000664 0000000 0000000 00000020215 12321543450 016732 0 ustar
DetailWidget
0
0
805
790
Form
16
24
60
20
0
0
805
51
25
71
48
48
55
100
16
16
95
67
200
19
95
111
200
18
95
90
200
18
335
87
120
18
490
70
279
49
500
76
66
17
614
74
41
41
668
77
80
17
668
96
80
17
25
170
66
17
详细介绍
95
178
690
1
520
130
64
22
595
130
64
22
670
130
64
22
25
200
744
40
25
240
744
131
25
390
66
17
软件截图
95
398
690
1
10
418
777
207
0
460
51
116
750
460
49
114
25
650
66
17
用户评论
95
658
690
1
650
640
120
17
0
680
815
85
350
500
1
1
350
530
1
1
ubuntu-kylin-software-center-0.2.9.2/ui/loadingdiv.py 0000664 0000000 0000000 00000006107 12321543450 017440 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from models.enums import UBUNTUKYLIN_RES_PATH
class LoadingDiv(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self,parent)
self.setGeometry(40, 0, 815, 611)
self.setAutoFillBackground(True)
palette = QPalette()
img = QPixmap(UBUNTUKYLIN_RES_PATH + "div1.png")
palette.setBrush(QPalette.Window, QBrush(img))
self.setPalette(palette)
self.gif = QMovie(UBUNTUKYLIN_RES_PATH + "loading-big.gif")
self.loadinggif = QLabel(self)
self.loadinggif.setGeometry(815 / 2 - 25, 611 / 2 - 28, 58, 45)
self.loadinggif.setMovie(self.gif)
self.loadingtext = QLabel(self)
self.loadingtext.setGeometry(815 / 2 - 90, 611 / 2 + 28, 200, 20)
self.loadingtext.setAlignment(Qt.AlignCenter)
self.loadingtext.setStyleSheet("QLabel{color:#1E66A4;font-size:16px;}")
self.raise_()
self.hide()
def start_loading(self, loadingText):
self.loadingtext.setText(loadingText)
self.gif.start()
self.show()
def stop_loading(self):
self.gif.stop()
self.hide()
class MiniLoadingDiv(QWidget):
# parent of the request component
parent_ = ''
x_ = ''
y_ = ''
width_ = ''
height_ = ''
def __init__(self, onwhich, parent=None):
QWidget.__init__(self, parent)
self.parent_ = parent
self.x_ = onwhich.x()
self.y_ = onwhich.y()
self.width_ = onwhich.width()
self.height_ = onwhich.height()
self.setGeometry(self.x_, self.y_, self.width_, self.height_)
self.gif = QMovie(UBUNTUKYLIN_RES_PATH + "loading.gif")
self.loadinggif = QLabel(self)
self.loadinggif.setGeometry(self.width_ / 2 - 25, self.height_ / 2 - 25, 50, 50)
self.loadinggif.setMovie(self.gif)
# self.loadingtext = QLabel(self)
# self.loadingtext.setGeometry(self.loadinggif.x() + 25 - 150, self.loadinggif.y() + 55, 300, 20)
# self.loadingtext.setAlignment(Qt.AlignCenter)
self.raise_()
self.hide()
def start_loading(self):
self.gif.start()
self.show()
def stop_loading(self):
self.gif.stop()
self.hide() ubuntu-kylin-software-center-0.2.9.2/ui/detailscrollwidget.py 0000664 0000000 0000000 00000064327 12321543450 021215 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
import os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.detailw import Ui_DetailWidget
from ui.starwidget import StarWidget
from ui.reviewwidget import ReviewWidget
from ui.listitemwidget import ListItemWidget
from ui.loadingdiv import *
from models.enums import (UBUNTUKYLIN_RES_TMPICON_PATH,
UBUNTUKYLIN_RES_ICON_PATH,
UBUNTUKYLIN_RES_SCREENSHOT_PATH,
Signals,
AppActions)
from utils import run
class DetailScrollWidget(QScrollArea):
mainwindow = ''
app = None
sshotcount = 0
bigsshot = ''
reviewpage = ''
currentreviewready = ''
def __init__(self, parent=None):
QScrollArea.__init__(self,parent.ui.centralwidget)
self.detailWidget = QWidget()
self.ui_init()
self.mainwindow = parent
self.setGeometry(QRect(46, 113, 815, 479))
self.setWidget(self.detailWidget)
self.bigsshot = ScreenShotBig()
self.ui.detailHeader.setAlignment(Qt.AlignCenter)
self.ui.detailHeader.setText("详细信息")
self.ui.detailHeader.lower()
self.ui.btnCloseDetail.setText("返回")
self.ui.btnCloseDetail.setFocusPolicy(Qt.NoFocus)
self.ui.btnInstall.setFocusPolicy(Qt.NoFocus)
self.ui.btnUpdate.setFocusPolicy(Qt.NoFocus)
self.ui.btnUninstall.setFocusPolicy(Qt.NoFocus)
self.ui.btnSshotBack.setFocusPolicy(Qt.NoFocus)
self.ui.btnSshotNext.setFocusPolicy(Qt.NoFocus)
self.ui.reviewListWidget.setFocusPolicy(Qt.NoFocus)
self.ui.thumbnail.setFocusPolicy(Qt.NoFocus)
self.ui.sshot.setFocusPolicy(Qt.NoFocus)
self.ui.summary.setReadOnly(True)
self.ui.description.setReadOnly(True)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.ui.btnCloseDetail.clicked.connect(self.slot_close_detail)
self.ui.btnInstall.clicked.connect(self.slot_click_install)
self.ui.btnUpdate.clicked.connect(self.slot_click_upgrade)
self.ui.btnUninstall.clicked.connect(self.slot_click_uninstall)
self.ui.thumbnail.clicked.connect(self.slot_show_sshot)
self.ui.sshot.clicked.connect(self.ui.sshot.hide)
self.verticalScrollBar().valueChanged.connect(self.slot_scroll_end)
# style
self.detailWidget.setAutoFillBackground(True)
palette = QPalette()
palette.setColor(QPalette.Background, Qt.white)
self.detailWidget.setPalette(palette)
self.setAutoFillBackground(True)
self.setPalette(palette)
self.verticalScrollBar().setStyleSheet("QScrollBar:vertical{width:12px;background-color:black;margin:0px,0px,0px,0px;padding-top:0px;padding-bottom:0px;}"
"QScrollBar:sub-page:vertical{background:qlineargradient(x1: 0.5, y1: 1, x2: 0.5, y2: 0, stop: 0 #D4DCE1, stop: 1 white);}QScrollBar:add-page:vertical{background:qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #D4DCE1, stop: 1 white);}"
"QScrollBar:handle:vertical{background:qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #CACACA, stop: 1 #818486);}QScrollBar:add-line:vertical{background-color:green;}")
self.ui.name.setStyleSheet("QLabel{font-size:16px;font-weight:bold;}")
self.ui.splitText1.setStyleSheet("QLabel{color:#1E66A4;font-size:16px;}")
self.ui.splitText2.setStyleSheet("QLabel{color:#1E66A4;font-size:16px;}")
self.ui.splitText3.setStyleSheet("QLabel{color:#1E66A4;font-size:16px;}")
self.ui.splitLine1.setStyleSheet("QLabel{background-color:#E0E0E0;}")
self.ui.splitLine2.setStyleSheet("QLabel{background-color:#E0E0E0;}")
self.ui.splitLine3.setStyleSheet("QLabel{background-color:#E0E0E0;}")
self.ui.detailHeader.setStyleSheet("QLabel{background-image:url('res/detailheadbg.png');color:black;font-size:14px;padding-top:17px;}")
self.ui.btnCloseDetail.setStyleSheet("QPushButton{background-image:url('res/btn2-1.png');border:0px;color:#497FAB;}QPushButton:hover{background:url('res/btn2-2.png');}QPushButton:pressed{background:url('res/btn2-3.png');}")
self.ui.candidateVersion.setStyleSheet("QLabel{color:#FF7D15;}")
self.ui.gradeBG.setStyleSheet("QLabel{background-image:url('res/gradebg.png')}")
self.ui.grade.setStyleSheet("QLabel{font-size:30px;color:#1E66A4;}")
self.ui.gradeText2.setStyleSheet("QLabel{font-size:13px;}")
self.ui.gradeText3.setStyleSheet("QLabel{font-size:13px;color:#9AA2AF;}")
self.ui.summary.setStyleSheet("QTextEdit{border:0px;}")
self.ui.description.setStyleSheet("QTextEdit{border:0px;}")
self.ui.description.verticalScrollBar().setStyleSheet("QScrollBar:vertical{width:11px;background-color:black;margin:0px,0px,0px,0px;padding-top:0px;padding-bottom:0px;}"
"QScrollBar:sub-page:vertical{background:qlineargradient(x1: 0.5, y1: 1, x2: 0.5, y2: 0, stop: 0 #D4DCE1, stop: 1 white);}QScrollBar:add-page:vertical{background:qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #D4DCE1, stop: 1 white);}"
"QScrollBar:handle:vertical{background:qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #CACACA, stop: 1 #818486);}QScrollBar:add-line:vertical{background-color:green;}")
self.ui.sshotBG.setStyleSheet("QLabel{background-image:url('res/sshotbg.png')}")
self.ui.btnSshotBack.setStyleSheet("QPushButton{border:0px;background-image:url('res/btn-sshot-back-1.png')}QPushButton:hover{background-image:url('res/btn-sshot-back-2')}QPushButton:pressed{background-image:url('res/btn-sshot-back-3')}")
self.ui.btnSshotNext.setStyleSheet("QPushButton{border:0px;background-image:url('res/btn-sshot-next-1.png')}QPushButton:hover{background-image:url('res/btn-sshot-next-2')}QPushButton:pressed{background-image:url('res/btn-sshot-next-3')}")
self.ui.reviewListWidget.setStyleSheet("QListWidget{border:0px;}QListWidget::item{height:85px;margin-top:-1px;border:0px;}")
self.ui.thumbnail.hide()
self.hide()
# mini loading div
self.sshotload = MiniLoadingDiv(self.ui.sshotBG, self.detailWidget)
self.reviewload = MiniLoadingDiv(self.ui.reviewListWidget, self.detailWidget)
self.connect(self.mainwindow,Signals.apt_process_finish,self.slot_work_finished)
self.connect(self.mainwindow,Signals.apt_process_cancel,self.slot_work_cancel)
def ui_init(self):
self.ui = Ui_DetailWidget()
self.ui.setupUi(self.detailWidget)
# fill fast property, show ui, request remote property
def showSimple(self, app):
# clear reviews
self.reviewpage = 1
self.currentreviewready = False
self.ui.reviewListWidget.clear()
self.detailWidget.resize(805, 790)
self.ui.reviewListWidget.resize(805, 0)
self.reviewload.move(self.ui.reviewListWidget.x(), self.ui.reviewListWidget.y())
# clear sshot
self.sshotcount = 0
self.ui.thumbnail.hide()
self.app = app
self.ui.name.setText(app.name)
self.ui.installedVersion.setText("当前版本: " + app.installed_version)
self.ui.candidateVersion.setText("最新版本: " + app.candidate_version)
self.ui.summary.setText(app.summary)
self.ui.description.setText(app.description)
if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + str(app.name) + ".png')}")
elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + str(app.name) + ".jpg')}")
elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".png")):
self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_TMPICON_PATH + str(app.name) + ".png')}")
elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".jpg")):
self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_TMPICON_PATH + str(app.name) + ".jpg')}")
else:
self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + "default.png')}")
size = app.packageSize
sizek = size / 1024
#self.ui.size.setText("软件大小: " + str(sizek) + " K")
if(sizek < 1024):
self.ui.size.setText("软件大小: " + str(sizek) + " KB")
else:
self.ui.size.setText("软件大小: " + str('%.2f'%(sizek/1024.0)) + " MB")
self.ui.gradeText1.setText("我的评分: ")
self.ui.gradeText2.setText("评分" + (str(app.ratings_total)) + "次")
self.ui.commentNumber.setText("共 " + str(app.ratings_total) + " 条评论")
self.ui.gradeText3.setText("满分5分")
self.ui.grade.setText(str(app.ratings_average))
self.star = StarWidget('big', app.ratings_average, self.detailWidget)
self.star.move(500, 94)
if(app.is_installed):
self.ui.status.setStyleSheet("QLabel{background-image:url('res/installed.png')}")
self.ui.status.show()
if(run.get_run_command(self.app.name) == ""):
self.ui.btnInstall.setEnabled(False)
self.ui.btnInstall.setText("已安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
else:
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("启动")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn4-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setText("可卸载")
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn5-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn5-2.png');}QPushButton:pressed{background:url('res/btn5-3.png');}")
else:
# self.ui.status.setStyleSheet("QLabel{background-image:url('res/notinstall.png')}")
self.ui.status.hide()
self.ui.btnInstall.setText("安装")
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUninstall.setText("不可卸载")
self.ui.btnInstall.setEnabled(True)
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUninstall.setEnabled(False)
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.show()
# show loading
self.sshotload.start_loading()
self.reviewload.start_loading()
# send request
self.mainwindow.appmgr.get_application_reviews(app.name)
self.mainwindow.appmgr.get_application_screenshots(app.name,UBUNTUKYLIN_RES_SCREENSHOT_PATH)
def add_review(self, reviewlist):
# print len(reviewlist)
for review in reviewlist:
# not this app's review break
if(review.package_name != self.app.name):
break
self.add_one_review(review)
self.reviewpage += 1
self.currentreviewready = True
self.reviewload.stop_loading()
def add_one_review(self, review):
count = self.ui.reviewListWidget.count()
reviewHeight = (count + 1) * 85
self.detailWidget.resize(805, 790 + reviewHeight)
self.ui.reviewListWidget.resize(805, reviewHeight)
oneitem = QListWidgetItem()
rliw = ReviewWidget(review)
self.ui.reviewListWidget.addItem(oneitem)
self.ui.reviewListWidget.setItemWidget(oneitem, rliw)
def add_sshot(self, sclist):
self.sshotcount = len(sclist)
if(self.sshotcount > 0):
img = QPixmap(self.app.thumbnailfile)
self.ui.thumbnail.resize(img.width(), img.height())
self.ui.thumbnail.setStyleSheet("QPushButton{background-image:url('" + self.app.thumbnailfile + "');border:0px;}")
self.ui.thumbnail.move(400 - img.width() / 2, 521 - img.height() / 2)
self.ui.thumbnail.show()
if(self.sshotcount > 1):
img = QPixmap(self.app.screenshotfile)
self.bigsshot.resize(img.width(), img.height())
self.bigsshot.bg.resize(img.width(), img.height())
self.bigsshot.bg.setStyleSheet("QLabel{background-image:url('" + self.app.screenshotfile + "');}")
self.sshotload.stop_loading()
def slot_show_sshot(self):
if(self.sshotcount > 1):
self.bigsshot.move_to_center()
self.bigsshot.show()
def slot_close_detail(self):
self.hide()
def slot_click_install(self):
if(self.ui.btnInstall.text() == "启动"):
run.run_app(self.app.name)
else:
self.emit(Signals.install_app, self.app)
self.ui.btnInstall.setText("处理中")
self.ui.btnInstall.setEnabled(False)
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUninstall.setEnabled(False)
def slot_click_upgrade(self):
self.emit(Signals.upgrade_app, self.app)
self.ui.btnUpdate.setText("处理中")
self.ui.btnInstall.setEnabled(False)
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUninstall.setEnabled(False)
def slot_click_uninstall(self):
self.emit(Signals.remove_app, self.app)
self.ui.btnUninstall.setText("处理中")
self.ui.btnInstall.setEnabled(False)
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUninstall.setEnabled(False)
def slot_work_finished(self, pkgname, action):
#add this to prevent slot received from other signal before show_detail is not called
if self.app is None:
return
if self.app.name == pkgname:
self.ui.status.show()
if action == AppActions.INSTALL:
if(run.get_run_command(self.app.name) == ""):
self.ui.btnInstall.setEnabled(False)
self.ui.btnInstall.setText("已安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
else:
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("启动")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn4-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setText("可卸载")
self.ui.btnUninstall.setEnabled(True)
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn5-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn5-2.png');}QPushButton:pressed{background:url('res/btn5-3.png');}")
elif action == AppActions.REMOVE:
self.ui.btnInstall.setText("安装")
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUninstall.setText("已卸载")
self.ui.btnInstall.setEnabled(True)
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUninstall.setEnabled(False)
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
elif action == AppActions.UPGRADE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btnInstall.setEnabled(False)
self.ui.btnInstall.setText("已安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
else:
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("启动")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setText("可卸载")
self.ui.btnUninstall.setEnabled(True)
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn5-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn5-2.png');}QPushButton:pressed{background:url('res/btn5-3.png');}")
def slot_work_cancel(self, pkgname, action):
if self.app.name == pkgname:
self.ui.status.show()
if action == AppActions.INSTALL:
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn4-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
self.ui.btnUninstall.setText("已卸载")
self.ui.btnUninstall.setEnabled(False)
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
elif action == AppActions.REMOVE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btnInstall.setEnabled(False)
self.ui.btnInstall.setText("已安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
else:
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("启动")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn4-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setText("可卸载")
self.ui.btnUninstall.setEnabled(True)
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn5-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn5-2.png');}QPushButton:pressed{background:url('res/btn5-3.png');}")
elif action == AppActions.UPGRADE:
if(run.get_run_command(self.app.name) == ""):
self.ui.btnInstall.setEnabled(False)
self.ui.btnInstall.setText("已安装")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
else:
self.ui.btnInstall.setEnabled(True)
self.ui.btnInstall.setText("启动")
self.ui.btnInstall.setStyleSheet("QPushButton{background-image:url('res/btn3-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn3-2.png');}QPushButton:pressed{background:url('res/btn3-3.png');}")
if self.app.is_upgradable:
self.ui.btnUpdate.setEnabled(True)
self.ui.btnUpdate.setText("可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn4-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn4-2.png');}QPushButton:pressed{background:url('res/btn4-3.png');}")
else:
self.ui.btnUpdate.setEnabled(False)
self.ui.btnUpdate.setText("不可升级")
self.ui.btnUpdate.setStyleSheet("QPushButton{background-image:url('res/btn-notenable.png');border:0px;color:#9AA2AF;}")
self.ui.btnUninstall.setText("可卸载")
self.ui.btnUninstall.setEnabled(True)
self.ui.btnUninstall.setStyleSheet("QPushButton{background-image:url('res/btn5-1.png');border:0px;color:white;}QPushButton:hover{background:url('res/btn5-2.png');}QPushButton:pressed{background:url('res/btn5-3.png');}")
def slot_scroll_end(self, now):
# current page not ready
if(self.currentreviewready == False):
pass
else:
max = self.verticalScrollBar().maximum()
if(now == max):
self.currentreviewready = False
reviewcount = self.ui.reviewListWidget.count()
self.reviewload.move(self.reviewload.x(), self.ui.reviewListWidget.y() + 84 * reviewcount)
self.reviewload.start_loading()
self.mainwindow.appmgr.get_application_reviews(self.app.name, page=self.reviewpage)
class ScreenShotBig(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setWindowFlags(Qt.FramelessWindowHint)
self.setWindowFlags(Qt.ToolTip)
self.bg = QLabel(self)
self.bg.move(0, 0)
self.bg.installEventFilter(self)
self.hide()
def eventFilter(self, obj, event):
if(obj == self.bg and event.type() == QEvent.MouseButtonRelease):
self.hide()
return True
def move_to_center(self):
windowWidth = QApplication.desktop().width()
windowHeight = QApplication.desktop().height()
self.move((windowWidth - self.width()) / 2, (windowHeight - self.height()) / 2)
ubuntu-kylin-software-center-0.2.9.2/ui/detailw.py 0000664 0000000 0000000 00000017767 12321543450 016767 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'detailw.ui'
#
# Created: Thu Mar 20 16:49:28 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_DetailWidget(object):
def setupUi(self, DetailWidget):
DetailWidget.setObjectName(_fromUtf8("DetailWidget"))
DetailWidget.resize(805, 790)
self.btnCloseDetail = QtGui.QPushButton(DetailWidget)
self.btnCloseDetail.setGeometry(QtCore.QRect(16, 24, 60, 20))
self.btnCloseDetail.setText(_fromUtf8(""))
self.btnCloseDetail.setObjectName(_fromUtf8("btnCloseDetail"))
self.detailHeader = QtGui.QLabel(DetailWidget)
self.detailHeader.setGeometry(QtCore.QRect(0, 0, 805, 51))
self.detailHeader.setText(_fromUtf8(""))
self.detailHeader.setObjectName(_fromUtf8("detailHeader"))
self.icon = QtGui.QLabel(DetailWidget)
self.icon.setGeometry(QtCore.QRect(25, 71, 48, 48))
self.icon.setText(_fromUtf8(""))
self.icon.setObjectName(_fromUtf8("icon"))
self.status = QtGui.QLabel(DetailWidget)
self.status.setGeometry(QtCore.QRect(55, 100, 16, 16))
self.status.setText(_fromUtf8(""))
self.status.setObjectName(_fromUtf8("status"))
self.name = QtGui.QLabel(DetailWidget)
self.name.setGeometry(QtCore.QRect(95, 67, 200, 19))
self.name.setText(_fromUtf8(""))
self.name.setObjectName(_fromUtf8("name"))
self.candidateVersion = QtGui.QLabel(DetailWidget)
self.candidateVersion.setGeometry(QtCore.QRect(95, 111, 200, 18))
self.candidateVersion.setText(_fromUtf8(""))
self.candidateVersion.setObjectName(_fromUtf8("candidateVersion"))
self.installedVersion = QtGui.QLabel(DetailWidget)
self.installedVersion.setGeometry(QtCore.QRect(95, 90, 200, 18))
self.installedVersion.setText(_fromUtf8(""))
self.installedVersion.setObjectName(_fromUtf8("installedVersion"))
self.size = QtGui.QLabel(DetailWidget)
self.size.setGeometry(QtCore.QRect(335, 87, 150, 18))
self.size.setText(_fromUtf8(""))
self.size.setObjectName(_fromUtf8("size"))
self.gradeBG = QtGui.QLabel(DetailWidget)
self.gradeBG.setGeometry(QtCore.QRect(490, 70, 279, 49))
self.gradeBG.setText(_fromUtf8(""))
self.gradeBG.setObjectName(_fromUtf8("gradeBG"))
self.gradeText1 = QtGui.QLabel(DetailWidget)
self.gradeText1.setGeometry(QtCore.QRect(500, 76, 66, 17))
self.gradeText1.setText(_fromUtf8(""))
self.gradeText1.setObjectName(_fromUtf8("gradeText1"))
self.grade = QtGui.QLabel(DetailWidget)
self.grade.setGeometry(QtCore.QRect(614, 74, 41, 41))
self.grade.setText(_fromUtf8(""))
self.grade.setObjectName(_fromUtf8("grade"))
self.gradeText2 = QtGui.QLabel(DetailWidget)
self.gradeText2.setGeometry(QtCore.QRect(668, 77, 80, 17))
self.gradeText2.setText(_fromUtf8(""))
self.gradeText2.setObjectName(_fromUtf8("gradeText2"))
self.gradeText3 = QtGui.QLabel(DetailWidget)
self.gradeText3.setGeometry(QtCore.QRect(668, 96, 80, 17))
self.gradeText3.setText(_fromUtf8(""))
self.gradeText3.setObjectName(_fromUtf8("gradeText3"))
self.splitText1 = QtGui.QLabel(DetailWidget)
self.splitText1.setGeometry(QtCore.QRect(25, 170, 66, 17))
self.splitText1.setObjectName(_fromUtf8("splitText1"))
self.splitLine1 = QtGui.QLabel(DetailWidget)
self.splitLine1.setGeometry(QtCore.QRect(95, 178, 690, 1))
self.splitLine1.setText(_fromUtf8(""))
self.splitLine1.setObjectName(_fromUtf8("splitLine1"))
self.btnInstall = QtGui.QPushButton(DetailWidget)
self.btnInstall.setGeometry(QtCore.QRect(520, 130, 64, 22))
self.btnInstall.setText(_fromUtf8(""))
self.btnInstall.setObjectName(_fromUtf8("btnInstall"))
self.btnUpdate = QtGui.QPushButton(DetailWidget)
self.btnUpdate.setGeometry(QtCore.QRect(595, 130, 64, 22))
self.btnUpdate.setText(_fromUtf8(""))
self.btnUpdate.setObjectName(_fromUtf8("btnUpdate"))
self.btnUninstall = QtGui.QPushButton(DetailWidget)
self.btnUninstall.setGeometry(QtCore.QRect(670, 130, 64, 22))
self.btnUninstall.setText(_fromUtf8(""))
self.btnUninstall.setObjectName(_fromUtf8("btnUninstall"))
self.summary = QtGui.QTextEdit(DetailWidget)
self.summary.setGeometry(QtCore.QRect(25, 200, 744, 40))
self.summary.setObjectName(_fromUtf8("summary"))
self.description = QtGui.QTextEdit(DetailWidget)
self.description.setGeometry(QtCore.QRect(25, 240, 744, 131))
self.description.setObjectName(_fromUtf8("description"))
self.splitText2 = QtGui.QLabel(DetailWidget)
self.splitText2.setGeometry(QtCore.QRect(25, 390, 66, 17))
self.splitText2.setObjectName(_fromUtf8("splitText2"))
self.splitLine2 = QtGui.QLabel(DetailWidget)
self.splitLine2.setGeometry(QtCore.QRect(95, 398, 690, 1))
self.splitLine2.setText(_fromUtf8(""))
self.splitLine2.setObjectName(_fromUtf8("splitLine2"))
self.sshotBG = QtGui.QLabel(DetailWidget)
self.sshotBG.setGeometry(QtCore.QRect(10, 418, 777, 207))
self.sshotBG.setText(_fromUtf8(""))
self.sshotBG.setObjectName(_fromUtf8("sshotBG"))
self.btnSshotBack = QtGui.QPushButton(DetailWidget)
self.btnSshotBack.setGeometry(QtCore.QRect(0, 460, 51, 116))
self.btnSshotBack.setText(_fromUtf8(""))
self.btnSshotBack.setObjectName(_fromUtf8("btnSshotBack"))
self.btnSshotNext = QtGui.QPushButton(DetailWidget)
self.btnSshotNext.setGeometry(QtCore.QRect(750, 460, 49, 114))
self.btnSshotNext.setText(_fromUtf8(""))
self.btnSshotNext.setObjectName(_fromUtf8("btnSshotNext"))
self.splitText3 = QtGui.QLabel(DetailWidget)
self.splitText3.setGeometry(QtCore.QRect(25, 650, 66, 17))
self.splitText3.setObjectName(_fromUtf8("splitText3"))
self.splitLine3 = QtGui.QLabel(DetailWidget)
self.splitLine3.setGeometry(QtCore.QRect(95, 658, 690, 1))
self.splitLine3.setText(_fromUtf8(""))
self.splitLine3.setObjectName(_fromUtf8("splitLine3"))
self.commentNumber = QtGui.QLabel(DetailWidget)
self.commentNumber.setGeometry(QtCore.QRect(650, 640, 120, 17))
self.commentNumber.setText(_fromUtf8(""))
self.commentNumber.setObjectName(_fromUtf8("commentNumber"))
self.reviewListWidget = QtGui.QListWidget(DetailWidget)
self.reviewListWidget.setGeometry(QtCore.QRect(0, 680, 815, 85))
self.reviewListWidget.setObjectName(_fromUtf8("reviewListWidget"))
self.thumbnail = QtGui.QPushButton(DetailWidget)
self.thumbnail.setGeometry(QtCore.QRect(350, 500, 1, 1))
self.thumbnail.setText(_fromUtf8(""))
self.thumbnail.setObjectName(_fromUtf8("thumbnail"))
self.sshot = QtGui.QPushButton(DetailWidget)
self.sshot.setGeometry(QtCore.QRect(350, 530, 1, 1))
self.sshot.setText(_fromUtf8(""))
self.sshot.setObjectName(_fromUtf8("sshot"))
self.retranslateUi(DetailWidget)
QtCore.QMetaObject.connectSlotsByName(DetailWidget)
def retranslateUi(self, DetailWidget):
DetailWidget.setWindowTitle(_translate("DetailWidget", "Form", None))
self.splitText1.setText(_translate("DetailWidget", "详细介绍", None))
self.splitText2.setText(_translate("DetailWidget", "软件截图", None))
self.splitText3.setText(_translate("DetailWidget", "用户评论", None))
ubuntu-kylin-software-center-0.2.9.2/ui/uksc.ui 0000664 0000000 0000000 00000015476 12321543450 016263 0 ustar
MainWindow
0
0
750
600
MainWindow
0
0
750
120
38
40
40
40
<
82
40
40
40
>
180
40
80
40
首页
280
40
80
40
升级
380
40
80
40
卸载
490
20
250
80
480
40
80
40
任务
0
121
750
30
560
0
113
27
680
0
60
27
O
0
152
160
417
0
60
160
357
161
152
589
417
0
0
589
150
80
210
81
17
推荐软件一
380
210
81
17
推荐软件三
240
210
81
17
推荐软件二
240
280
81
17
推荐软件五
380
280
81
17
推荐软件六
80
280
81
17
推荐软件四
0
570
750
30
161
152
589
417
listWidget
headerWidget
searchWidget
leftWidget
rightWidget
bottomWidget
ubuntu-kylin-software-center-0.2.9.2/ui/ranklistitemwidget.py 0000664 0000000 0000000 00000003125 12321543450 021227 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.ukrliw import Ui_RankListWidget
class RankListItemWidget(QWidget):
def __init__(self, name, rank, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.ui.name.setText(name)
self.ui.iconnumber.setText(str(rank))
self.ui.iconnumber.setAlignment(Qt.AlignCenter)
self.ui.iconnumber.setStyleSheet("QLabel{color:white;font-size:12px;}")
if(rank < 4):
self.ui.iconbg.setStyleSheet("QLabel{background-color:#FF7C14;}")
else:
self.ui.iconbg.setStyleSheet("QLabel{background-color:#2B8AC2;}")
def ui_init(self):
self.ui = Ui_RankListWidget()
self.ui.setupUi(self)
self.show() ubuntu-kylin-software-center-0.2.9.2/ui/adwidget.py 0000664 0000000 0000000 00000016373 12321543450 017116 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# maclin
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from models.advertisement import Advertisement
from models.enums import (AD_BUTTON_STYLE,UBUNTUKYLIN_RES_AD_PATH)
class ADWidget(QWidget):
# ad model list
ads = []
# adbtn list
adbs = []
# now index
adi = 0
# ad len
adl = 0
# auto change ad timer
adtimer = ''
# movie timer
admtimer = ''
# now ad x
adx = 0
# distance to target
distance = 0
def __init__(self, addata, parent=None):
QWidget.__init__(self,parent.ui.homepageWidget)
self.ui_init()
self.parent = parent
self.setAutoFillBackground(True)
palette = QPalette()
img = QPixmap("res/adback.png")
palette.setBrush(QPalette.Window, QBrush(img))
self.setPalette(palette)
self.adl = len(addata)
self.adContentWidget.setGeometry(QRect(0, 0, self.adl * 663, 186))
if self.adl > 0:
self.create_ads(addata, parent)
self.adtimer = QTimer(self)
self.adtimer.timeout.connect(self.slot_adtimer_timeout)
self.adtimer.start(3000)
self.admtimer = QTimer(self)
self.admtimer.timeout.connect(self.slot_admtimer_update)
self.slot_change_ad(self.adi)
self.show()
def add_advertisements(self, addata):
self.adl = len(addata)
self.adContentWidget.setGeometry(QRect(0, 0, self.adl * 663, 186))
self.create_ads(addata, self.parent)
self.adtimer.start(3000)
self.slot_change_ad(self.adi)
self.show()
def ui_init(self):
self.resize(663, 214)
self.adContentWidget = QWidget(self)
self.adContentWidget.setGeometry(QRect(0, 0, 663, 186))
self.adContentWidget.setObjectName("adContentWidget")
self.softCountText1 = QLabel(self)
self.softCountText1.setGeometry(QRect(10, 193, 32, 17))
self.softCountText1.setObjectName("softCountText1")
self.softCountText1.setText("共有")
self.softCount = QLabel(self)
self.softCount.setGeometry(QRect(42, 193, 51, 17))
self.softCount.setText("")
self.softCount.setObjectName("softCount")
self.softCountText2 = QLabel(self)
self.softCountText2.setGeometry(QRect(97, 193, 51, 17))
self.softCountText2.setObjectName("softCountText2")
self.softCountText2.setText("款软件")
self.softCount.setAlignment(Qt.AlignCenter)
self.softCountText1.setStyleSheet("QLabel{color:#B8692C;font-size:14px;font-weight:bold;}")
self.softCountText2.setStyleSheet("QLabel{color:#B8692C;font-size:14px;font-weight:bold;}")
self.softCount.setStyleSheet("QLabel{color:#D7AF6A;font-size:16px;font-weight:bold;}")
def create_ads(self, addata, parent):
i = 0
adx = 0
adbx = 570
for one in addata:
ad = ADButton(one, self.adContentWidget)
ad.resize(663, 186)
ad.move(adx, 0)
adx += 663
ad.setFocusPolicy(Qt.NoFocus)
ad.setCursor(Qt.PointingHandCursor)
ad.setStyleSheet(AD_BUTTON_STYLE % (UBUNTUKYLIN_RES_AD_PATH + one.pic))
ad.connect(ad, SIGNAL("adsignal"), parent.slot_click_ad)
self.ads.append(ad)
adbtn = ADButton(i, self)
adbtn.resize(16, 18)
adbtn.move(adbx, 193)
adbx += 20
adbtn.setFocusPolicy(Qt.NoFocus)
adbtn.setStyleSheet("QPushButton{background-image:url('res/adbtn-1.png');border:0px;}QPushButton:pressed{background:url('res/adbtn-2.png');}")
adbtn.connect(adbtn, SIGNAL("adsignal"), self.slot_change_ad_immediately)
self.adbs.append(adbtn)
i += 1
def slot_change_ad_immediately(self, i):
self.adi = i
for adb in self.adbs:
adb.setStyleSheet("QPushButton{background-image:url('res/adbtn-1.png');border:0px;}QPushButton:pressed{background-image:url('res/adbtn-2.png');border:0px;}")
self.adbs[i].setStyleSheet("QPushButton{background-image:url('res/adbtn-2.png');border:0px;}")
self.adx = self.adi * 663 * - 1
self.adContentWidget.move(self.adx, 0)
self.admtimer.stop()
self.adtimer.start(2500)
def slot_change_ad(self, i):
if(len(self.adbs) == 0):
return
self.lock_adbs(False)
self.adi = i
for adb in self.adbs:
adb.setStyleSheet("QPushButton{background-image:url('res/adbtn-1.png');border:0px;}QPushButton:pressed{background-image:url('res/adbtn-2.png');border:0px;}")
self.adbs[i].setStyleSheet("QPushButton{background-image:url('res/adbtn-2.png');border:0px;}")
# self.adContentWidget.move(i * 663 * -1, 0)
self.distance = self.adi * 663 - self.adContentWidget.x()
# self.adtimer.stop()
self.admtimer.stop()
self.admtimer.start(12)
def slot_adtimer_timeout(self):
if(self.adi == (self.adl - 1)):
self.adi = 0
else:
self.adi += 1
self.adtimer.stop()
self.slot_change_ad(self.adi)
def slot_admtimer_update(self):
if(self.adx - self.adi * 663 * -1 <= 8):
self.adx = self.adi * 663 * - 1
self.adContentWidget.move(self.adx, 0)
self.lock_adbs(True)
self.admtimer.stop()
self.adtimer.start(2500)
else:
self.adx -= 8
self.adContentWidget.move(self.adx, 0)
def lock_adbs(self, flag):
for btn in self.adbs:
btn.setEnabled(flag)
def update_total_count(self,count):
self.softCount.setText(str(count))
class ADButton(QPushButton):
obj = ''
def __init__(self, obj, parent):
QPushButton.__init__(self, parent)
self.obj = obj
self.pressed.connect(self.adclicked)
def adclicked(self):
self.emit(SIGNAL("adsignal"),self.obj)
def main():
import sys
app = QApplication(sys.argv)
QTextCodec.setCodecForTr(QTextCodec.codecForName("UTF-8"))
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
tmpads = []
tmpads.append(Advertisement("qq", "url", "ad1.png", "http://www.baidu.com"))
tmpads.append(Advertisement("wps", "pkg", "ad2.png", "wps"))
tmpads.append(Advertisement("qt", "pkg", "ad3.png", "qtcreator"))
adw = ADWidget(tmpads)
adw.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
ubuntu-kylin-software-center-0.2.9.2/ui/mainwindow.py 0000664 0000000 0000000 00000034034 12321543450 017474 0 ustar # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created: Thu Mar 13 15:21:16 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(907, 620)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.leftWidget = QtGui.QWidget(self.centralwidget)
self.leftWidget.setGeometry(QtCore.QRect(46, 113, 152, 479))
self.leftWidget.setObjectName(_fromUtf8("leftWidget"))
self.categoryView = QtGui.QListWidget(self.leftWidget)
self.categoryView.setGeometry(QtCore.QRect(0, 163, 152, 316))
self.categoryView.setObjectName(_fromUtf8("categoryView"))
self.userWidget = QtGui.QWidget(self.leftWidget)
self.userWidget.setGeometry(QtCore.QRect(0, 0, 152, 133))
self.userWidget.setObjectName(_fromUtf8("userWidget"))
self.userLabel = QtGui.QLabel(self.userWidget)
self.userLabel.setGeometry(QtCore.QRect(0, 0, 152, 133))
self.userLabel.setText(_fromUtf8(""))
self.userLabel.setObjectName(_fromUtf8("userLabel"))
self.hline1 = QtGui.QLabel(self.leftWidget)
self.hline1.setGeometry(QtCore.QRect(0, 161, 152, 2))
self.hline1.setText(_fromUtf8(""))
self.hline1.setObjectName(_fromUtf8("hline1"))
self.categorytext = QtGui.QLabel(self.leftWidget)
self.categorytext.setGeometry(QtCore.QRect(0, 133, 152, 28))
self.categorytext.setObjectName(_fromUtf8("categorytext"))
self.homepageWidget = QtGui.QWidget(self.centralwidget)
self.homepageWidget.setGeometry(QtCore.QRect(198, 113, 663, 479))
self.homepageWidget.setObjectName(_fromUtf8("homepageWidget"))
self.recommendWidget = QtGui.QWidget(self.homepageWidget)
self.recommendWidget.setGeometry(QtCore.QRect(0, 214, 529, 265))
self.recommendWidget.setObjectName(_fromUtf8("recommendWidget"))
self.rankWidget = QtGui.QWidget(self.homepageWidget)
self.rankWidget.setGeometry(QtCore.QRect(530, 214, 133, 265))
self.rankWidget.setObjectName(_fromUtf8("rankWidget"))
self.rankLogo = QtGui.QLabel(self.rankWidget)
self.rankLogo.setGeometry(QtCore.QRect(8, 10, 16, 16))
self.rankLogo.setText(_fromUtf8(""))
self.rankLogo.setObjectName(_fromUtf8("rankLogo"))
self.rankText = QtGui.QLabel(self.rankWidget)
self.rankText.setGeometry(QtCore.QRect(27, 11, 45, 16))
self.rankText.setObjectName(_fromUtf8("rankText"))
self.btnDay = QtGui.QPushButton(self.rankWidget)
self.btnDay.setGeometry(QtCore.QRect(74, 10, 14, 15))
self.btnDay.setText(_fromUtf8(""))
self.btnDay.setObjectName(_fromUtf8("btnDay"))
self.btnWeek = QtGui.QPushButton(self.rankWidget)
self.btnWeek.setGeometry(QtCore.QRect(92, 10, 14, 15))
self.btnWeek.setText(_fromUtf8(""))
self.btnWeek.setObjectName(_fromUtf8("btnWeek"))
self.btnMonth = QtGui.QPushButton(self.rankWidget)
self.btnMonth.setGeometry(QtCore.QRect(110, 10, 14, 15))
self.btnMonth.setText(_fromUtf8(""))
self.btnMonth.setObjectName(_fromUtf8("btnMonth"))
self.btnDownTimes = QtGui.QPushButton(self.rankWidget)
self.btnDownTimes.setGeometry(QtCore.QRect(3, 34, 65, 28))
self.btnDownTimes.setObjectName(_fromUtf8("btnDownTimes"))
self.btnGrade = QtGui.QPushButton(self.rankWidget)
self.btnGrade.setGeometry(QtCore.QRect(66, 34, 65, 28))
self.btnGrade.setObjectName(_fromUtf8("btnGrade"))
self.rankView = QtGui.QListWidget(self.rankWidget)
self.rankView.setGeometry(QtCore.QRect(0, 62, 133, 203))
self.rankView.setObjectName(_fromUtf8("rankView"))
self.vline1 = QtGui.QLabel(self.homepageWidget)
self.vline1.setGeometry(QtCore.QRect(529, 214, 1, 265))
self.vline1.setText(_fromUtf8(""))
self.vline1.setObjectName(_fromUtf8("vline1"))
self.bottomWidget = QtGui.QWidget(self.centralwidget)
self.bottomWidget.setGeometry(QtCore.QRect(40, 592, 827, 28))
self.bottomWidget.setObjectName(_fromUtf8("bottomWidget"))
self.bottomImg = QtGui.QLabel(self.bottomWidget)
self.bottomImg.setGeometry(QtCore.QRect(12, 4, 18, 18))
self.bottomImg.setText(_fromUtf8(""))
self.bottomImg.setObjectName(_fromUtf8("bottomImg"))
self.bottomText1 = QtGui.QLabel(self.bottomWidget)
self.bottomText1.setGeometry(QtCore.QRect(37, 3, 140, 19))
self.bottomText1.setText(_fromUtf8(""))
self.bottomText1.setObjectName(_fromUtf8("bottomText1"))
self.bottomText2 = QtGui.QLabel(self.bottomWidget)
self.bottomText2.setGeometry(QtCore.QRect(182, 3, 70, 19))
self.bottomText2.setText(_fromUtf8(""))
self.bottomText2.setObjectName(_fromUtf8("bottomText2"))
self.upWidget = QtGui.QWidget(self.centralwidget)
self.upWidget.setGeometry(QtCore.QRect(198, 113, 663, 479))
self.upWidget.setObjectName(_fromUtf8("upWidget"))
self.upListWidget = QtGui.QListWidget(self.upWidget)
self.upListWidget.setGeometry(QtCore.QRect(0, 79, 663, 400))
self.upListWidget.setObjectName(_fromUtf8("upListWidget"))
self.upHeader = QtGui.QLabel(self.upWidget)
self.upHeader.setGeometry(QtCore.QRect(0, 55, 663, 24))
self.upHeader.setText(_fromUtf8(""))
self.upHeader.setObjectName(_fromUtf8("upHeader"))
self.upMSGBar = QtGui.QLabel(self.upWidget)
self.upMSGBar.setGeometry(QtCore.QRect(0, 0, 663, 55))
self.upMSGBar.setText(_fromUtf8(""))
self.upMSGBar.setObjectName(_fromUtf8("upMSGBar"))
self.unWidget = QtGui.QWidget(self.centralwidget)
self.unWidget.setGeometry(QtCore.QRect(198, 113, 663, 479))
self.unWidget.setObjectName(_fromUtf8("unWidget"))
self.unListWidget = QtGui.QListWidget(self.unWidget)
self.unListWidget.setGeometry(QtCore.QRect(0, 79, 663, 400))
self.unListWidget.setObjectName(_fromUtf8("unListWidget"))
self.unHeader = QtGui.QLabel(self.unWidget)
self.unHeader.setGeometry(QtCore.QRect(0, 55, 663, 24))
self.unHeader.setText(_fromUtf8(""))
self.unHeader.setObjectName(_fromUtf8("unHeader"))
self.unMSGBar = QtGui.QLabel(self.unWidget)
self.unMSGBar.setGeometry(QtCore.QRect(0, 0, 663, 55))
self.unMSGBar.setText(_fromUtf8(""))
self.unMSGBar.setObjectName(_fromUtf8("unMSGBar"))
self.allsWidget = QtGui.QWidget(self.centralwidget)
self.allsWidget.setGeometry(QtCore.QRect(198, 113, 663, 479))
self.allsWidget.setObjectName(_fromUtf8("allsWidget"))
self.allsListWidget = QtGui.QListWidget(self.allsWidget)
self.allsListWidget.setGeometry(QtCore.QRect(0, 79, 663, 400))
self.allsListWidget.setObjectName(_fromUtf8("allsListWidget"))
self.allsHeader = QtGui.QLabel(self.allsWidget)
self.allsHeader.setGeometry(QtCore.QRect(0, 55, 663, 24))
self.allsHeader.setText(_fromUtf8(""))
self.allsHeader.setObjectName(_fromUtf8("allsHeader"))
self.allsMSGBar = QtGui.QLabel(self.allsWidget)
self.allsMSGBar.setGeometry(QtCore.QRect(0, 0, 663, 55))
self.allsMSGBar.setText(_fromUtf8(""))
self.allsMSGBar.setObjectName(_fromUtf8("allsMSGBar"))
self.item1Widget = QtGui.QWidget(self.centralwidget)
self.item1Widget.setGeometry(QtCore.QRect(6, 113, 56, 134))
self.item1Widget.setObjectName(_fromUtf8("item1Widget"))
self.item2Widget = QtGui.QWidget(self.centralwidget)
self.item2Widget.setGeometry(QtCore.QRect(6, 268, 40, 90))
self.item2Widget.setObjectName(_fromUtf8("item2Widget"))
self.btnClose = QtGui.QPushButton(self.centralwidget)
self.btnClose.setGeometry(QtCore.QRect(6, 247, 40, 21))
self.btnClose.setText(_fromUtf8(""))
self.btnClose.setObjectName(_fromUtf8("btnClose"))
self.btnMin = QtGui.QPushButton(self.centralwidget)
self.btnMin.setGeometry(QtCore.QRect(6, 277, 40, 21))
self.btnMin.setText(_fromUtf8(""))
self.btnMin.setObjectName(_fromUtf8("btnMin"))
self.btnSkin = QtGui.QPushButton(self.centralwidget)
self.btnSkin.setGeometry(QtCore.QRect(6, 307, 40, 21))
self.btnSkin.setText(_fromUtf8(""))
self.btnSkin.setObjectName(_fromUtf8("btnSkin"))
self.btnConf = QtGui.QPushButton(self.centralwidget)
self.btnConf.setGeometry(QtCore.QRect(6, 337, 40, 21))
self.btnConf.setText(_fromUtf8(""))
self.btnConf.setObjectName(_fromUtf8("btnConf"))
self.headerWidget = QtGui.QWidget(self.centralwidget)
self.headerWidget.setGeometry(QtCore.QRect(0, 0, 907, 141))
self.headerWidget.setObjectName(_fromUtf8("headerWidget"))
self.btnBack = QtGui.QPushButton(self.headerWidget)
self.btnBack.setGeometry(QtCore.QRect(70, 28, 41, 41))
self.btnBack.setText(_fromUtf8(""))
self.btnBack.setObjectName(_fromUtf8("btnBack"))
self.btnNext = QtGui.QPushButton(self.headerWidget)
self.btnNext.setGeometry(QtCore.QRect(126, 28, 41, 41))
self.btnNext.setText(_fromUtf8(""))
self.btnNext.setObjectName(_fromUtf8("btnNext"))
self.btnHomepage = QtGui.QPushButton(self.headerWidget)
self.btnHomepage.setGeometry(QtCore.QRect(221, 30, 77, 34))
self.btnHomepage.setText(_fromUtf8(""))
self.btnHomepage.setObjectName(_fromUtf8("btnHomepage"))
self.btnUp = QtGui.QPushButton(self.headerWidget)
self.btnUp.setGeometry(QtCore.QRect(319, 30, 77, 34))
self.btnUp.setText(_fromUtf8(""))
self.btnUp.setObjectName(_fromUtf8("btnUp"))
self.btnUn = QtGui.QPushButton(self.headerWidget)
self.btnUn.setGeometry(QtCore.QRect(419, 30, 77, 34))
self.btnUn.setText(_fromUtf8(""))
self.btnUn.setObjectName(_fromUtf8("btnUn"))
self.logoImg = QtGui.QLabel(self.headerWidget)
self.logoImg.setGeometry(QtCore.QRect(667, 21, 159, 56))
self.logoImg.setText(_fromUtf8(""))
self.logoImg.setObjectName(_fromUtf8("logoImg"))
self.btnTask = QtGui.QPushButton(self.headerWidget)
self.btnTask.setGeometry(QtCore.QRect(515, 30, 113, 34))
self.btnTask.setText(_fromUtf8(""))
self.btnTask.setObjectName(_fromUtf8("btnTask"))
self.leSearch = QtGui.QLineEdit(self.headerWidget)
self.leSearch.setGeometry(QtCore.QRect(670, 91, 154, 20))
self.leSearch.setObjectName(_fromUtf8("leSearch"))
self.searchicon = QtGui.QLabel(self.headerWidget)
self.searchicon.setGeometry(QtCore.QRect(675, 96, 10, 10))
self.searchicon.setText(_fromUtf8(""))
self.searchicon.setObjectName(_fromUtf8("searchicon"))
self.searchWidget = QtGui.QWidget(self.centralwidget)
self.searchWidget.setGeometry(QtCore.QRect(198, 113, 663, 479))
self.searchWidget.setObjectName(_fromUtf8("searchWidget"))
self.searchListWidget = QtGui.QListWidget(self.searchWidget)
self.searchListWidget.setGeometry(QtCore.QRect(0, 79, 663, 400))
self.searchListWidget.setObjectName(_fromUtf8("searchListWidget"))
self.searchHeader = QtGui.QLabel(self.searchWidget)
self.searchHeader.setGeometry(QtCore.QRect(0, 55, 663, 24))
self.searchHeader.setText(_fromUtf8(""))
self.searchHeader.setObjectName(_fromUtf8("searchHeader"))
self.searchMSGBar = QtGui.QLabel(self.searchWidget)
self.searchMSGBar.setGeometry(QtCore.QRect(0, 0, 663, 55))
self.searchMSGBar.setText(_fromUtf8(""))
self.searchMSGBar.setObjectName(_fromUtf8("searchMSGBar"))
self.taskWidget = QtGui.QWidget(self.centralwidget)
self.taskWidget.setGeometry(QtCore.QRect(46, 113, 815, 479))
self.taskWidget.setObjectName(_fromUtf8("taskWidget"))
self.taskHeader = QtGui.QLabel(self.taskWidget)
self.taskHeader.setGeometry(QtCore.QRect(0, 55, 815, 24))
self.taskHeader.setText(_fromUtf8(""))
self.taskHeader.setObjectName(_fromUtf8("taskHeader"))
self.taskMSGBar = QtGui.QLabel(self.taskWidget)
self.taskMSGBar.setGeometry(QtCore.QRect(0, 0, 815, 55))
self.taskMSGBar.setText(_fromUtf8(""))
self.taskMSGBar.setObjectName(_fromUtf8("taskMSGBar"))
self.taskListWidget = QtGui.QListWidget(self.taskWidget)
self.taskListWidget.setGeometry(QtCore.QRect(0, 79, 815, 400))
self.taskListWidget.setObjectName(_fromUtf8("taskListWidget"))
self.leftBorder = QtGui.QLabel(self.centralwidget)
self.leftBorder.setGeometry(QtCore.QRect(40, 113, 6, 479))
self.leftBorder.setText(_fromUtf8(""))
self.leftBorder.setObjectName(_fromUtf8("leftBorder"))
self.rightBorder = QtGui.QLabel(self.centralwidget)
self.rightBorder.setGeometry(QtCore.QRect(861, 113, 6, 479))
self.rightBorder.setText(_fromUtf8(""))
self.rightBorder.setObjectName(_fromUtf8("rightBorder"))
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
self.categorytext.setText(_translate("MainWindow", "软件分类", None))
self.rankText.setText(_translate("MainWindow", "排行榜", None))
self.btnDownTimes.setText(_translate("MainWindow", "综合排行", None))
self.btnGrade.setText(_translate("MainWindow", "评分排行", None))
ubuntu-kylin-software-center-0.2.9.2/ui/starwidget.py 0000664 0000000 0000000 00000007521 12321543450 017476 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.uksw import Ui_StarWidget
class StarWidget(QWidget):
# small or big
size = ''
def __init__(self, size, grade, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.size = size
if(self.size == 'small'):
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-small-2.png')}")
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-small-2.png')}")
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-small-2.png')}")
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-small-2.png')}")
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-small-2.png')}")
elif(self.size == 'big'):
self.resize(98, 18)
self.ui.star1.setGeometry(1, 1, 16, 16)
self.ui.star2.setGeometry(21, 1, 16, 16)
self.ui.star3.setGeometry(41, 1, 16, 16)
self.ui.star4.setGeometry(61, 1, 16, 16)
self.ui.star5.setGeometry(81, 1, 16, 16)
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-2.png')}")
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-2.png')}")
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-2.png')}")
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-2.png')}")
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-2.png')}")
self.changeGrade(grade)
def ui_init(self):
self.ui = Ui_StarWidget()
self.ui.setupUi(self)
self.show()
def changeGrade(self, grade):
if(self.size == 'small'):
if(grade > 0):
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 1):
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 2):
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 3):
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 4):
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(self.size == 'big'):
if(grade > 0):
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 1):
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 2):
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 3):
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 4):
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-1.png')}") ubuntu-kylin-software-center-0.2.9.2/ui/ukrcmdw.ui 0000664 0000000 0000000 00000003214 12321543450 016755 0 ustar
UKrcmdw
0
0
176
88
Form
73
54
62
20
下载
20
20
48
48
73
16
100
17
73
34
100
17
24
35
40
18
ubuntu-kylin-software-center-0.2.9.2/ui/uksc.py 0000664 0000000 0000000 00000017427 12321543450 016274 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
# Form implementation generated from reading ui file 'uksc.ui'
#
# Created: Tue Jan 21 17:02:54 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(750, 600)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.headerWidget = QtGui.QWidget(self.centralwidget)
self.headerWidget.setGeometry(QtCore.QRect(0, 0, 750, 120))
self.headerWidget.setObjectName(_fromUtf8("headerWidget"))
# self.pushButton = QtGui.QPushButton(self.headerWidget)
# self.pushButton.setGeometry(QtCore.QRect(38, 40, 40, 40))
# self.pushButton.setObjectName(_fromUtf8("pushButton"))
# self.pushButton_2 = QtGui.QPushButton(self.headerWidget)
# self.pushButton_2.setGeometry(QtCore.QRect(82, 40, 40, 40))
# self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.pushButton_3 = QtGui.QPushButton(self.headerWidget)
self.pushButton_3.setGeometry(QtCore.QRect(280, 40, 80, 40))
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
# self.pushButton_4 = QtGui.QPushButton(self.headerWidget)
# self.pushButton_4.setGeometry(QtCore.QRect(280, 40, 80, 40))
# self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
# self.pushButton_5 = QtGui.QPushButton(self.headerWidget)
# self.pushButton_5.setGeometry(QtCore.QRect(380, 40, 80, 40))
# self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
self.pushButton_6 = QtGui.QPushButton(self.headerWidget)
self.pushButton_6.setGeometry(QtCore.QRect(380, 40, 80, 40))
self.pushButton_6.setObjectName(_fromUtf8("pushButton_6"))
# self.logoImg = QtGui.QLabel(self.headerWidget)
# self.logoImg.setGeometry(QtCore.QRect(490, 10, 200, 80))
# self.logoImg.setText(_fromUtf8(""))
# self.logoImg.setObjectName(_fromUtf8("logoImg"))
self.searchWidget = QtGui.QWidget(self.centralwidget)
self.searchWidget.setGeometry(QtCore.QRect(0, 121, 750, 30))
self.searchWidget.setObjectName(_fromUtf8("searchWidget"))
self.leSearch = QtGui.QLineEdit(self.searchWidget)
self.leSearch.setGeometry(QtCore.QRect(560, 0, 113, 27))
self.leSearch.setObjectName(_fromUtf8("leSearch"))
self.btnSearch = QtGui.QPushButton(self.searchWidget)
self.btnSearch.setGeometry(QtCore.QRect(680, 0, 60, 27))
self.btnSearch.setObjectName(_fromUtf8("btnSearch"))
self.leftWidget = QtGui.QWidget(self.centralwidget)
self.leftWidget.setGeometry(QtCore.QRect(0, 152, 160, 417))
self.leftWidget.setObjectName(_fromUtf8("leftWidget"))
self.categoryView = QtGui.QListWidget(self.leftWidget)
self.categoryView.setGeometry(QtCore.QRect(0, 0, 160, 414))
self.categoryView.setObjectName(_fromUtf8("categoryView"))
self.rightWidget = QtGui.QWidget(self.centralwidget)
self.rightWidget.setGeometry(QtCore.QRect(161, 152, 589, 417))
self.rightWidget.setObjectName(_fromUtf8("rightWidget"))
self.taskWidget = QtGui.QWidget(self.centralwidget)
self.taskWidget.setGeometry(QtCore.QRect(0,152,750,417))
self.taskWidget.setObjectName(_fromUtf8("taskWidget"))
self.ad = QtGui.QLabel(self.rightWidget)
self.ad.setGeometry(QtCore.QRect(0, 0, 589, 218))
self.ad.setText(_fromUtf8(""))
self.ad.setObjectName(_fromUtf8("ad"))
self.label = QtGui.QLabel(self.rightWidget)
self.label.setGeometry(QtCore.QRect(80, 250, 81, 17))
self.label.setObjectName(_fromUtf8("label"))
self.label_2 = QtGui.QLabel(self.rightWidget)
self.label_2.setGeometry(QtCore.QRect(380, 250, 81, 17))
self.label_2.setObjectName(_fromUtf8("label_2"))
self.label_3 = QtGui.QLabel(self.rightWidget)
self.label_3.setGeometry(QtCore.QRect(240, 250, 81, 17))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_4 = QtGui.QLabel(self.rightWidget)
self.label_4.setGeometry(QtCore.QRect(240, 320, 81, 17))
self.label_4.setObjectName(_fromUtf8("label_4"))
self.label_5 = QtGui.QLabel(self.rightWidget)
self.label_5.setGeometry(QtCore.QRect(380, 320, 81, 17))
self.label_5.setObjectName(_fromUtf8("label_5"))
self.label_6 = QtGui.QLabel(self.rightWidget)
self.label_6.setGeometry(QtCore.QRect(80, 320, 81, 17))
self.label_6.setObjectName(_fromUtf8("label_6"))
self.label_7 = QtGui.QLabel(self.taskWidget)
self.label_7.setGeometry(QtCore.QRect(100, 150, 500, 80))
self.label_7.setObjectName(_fromUtf8("label_7"))
self.label_7.setText("")
self.bottomWidget = QtGui.QWidget(self.centralwidget)
self.bottomWidget.setGeometry(QtCore.QRect(0, 570, 750, 30))
self.bottomWidget.setObjectName(_fromUtf8("bottomWidget"))
self.listWidget = QtGui.QListWidget(self.centralwidget)
self.listWidget.setGeometry(QtCore.QRect(161, 152, 589, 414))
self.listWidget.setObjectName(_fromUtf8("listWidget"))
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
data.taskWidget = self.label_7
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
# self.pushButton.setText(_translate("MainWindow", "<", None))
# self.pushButton_2.setText(_translate("MainWindow", ">", None))
self.pushButton_3.setText(_translate("MainWindow", "安装卸载", None))
# self.pushButton_4.setText(_translate("MainWindow", "升级", None))
# self.pushButton_5.setText(_translate("MainWindow", "卸载", None))
self.pushButton_6.setText(_translate("MainWindow", "任务列表", None))
self.btnSearch.setText(_translate("MainWindow", "O", None))
self.label.setText(_translate("MainWindow", "推荐软件一", None))
self.label_2.setText(_translate("MainWindow", "推荐软件三", None))
self.label_3.setText(_translate("MainWindow", "推荐软件二", None))
self.label_4.setText(_translate("MainWindow", "推荐软件五", None))
self.label_5.setText(_translate("MainWindow", "推荐软件六", None))
self.label_6.setText(_translate("MainWindow", "推荐软件四", None))
ubuntu-kylin-software-center-0.2.9.2/ui/messagebox.py 0000664 0000000 0000000 00000005131 12321543450 017451 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from models.enums import UBUNTUKYLIN_RES_PATH
class MessageBox(QObject):
# alert
alert = ''
# alert timer
alertTimer = ''
# alert alive timer
alertDelayTimer = ''
# opacity effect
alertGOE = ''
# opacity
ao = ''
# alert y
ay = ''
def __init__(self, parent=None):
QObject.__init__(self, parent)
self.alertTimer = QTimer(self)
self.alertTimer.timeout.connect(self.slot_alert_step)
self.alertDelayTimer = QTimer(self)
self.alertDelayTimer.timeout.connect(self.slot_hide_alert)
self.alertGOE = QGraphicsOpacityEffect()
self.alert = QPushButton(parent)
self.alert.setGeometry(353, 380, 190, 95)
self.alert.setFocusPolicy(Qt.NoFocus)
self.alert.setGraphicsEffect(self.alertGOE)
self.alert.setStyleSheet("QPushButton{background-image:url('" + UBUNTUKYLIN_RES_PATH + "alert.png');border:0px;padding-bottom:5px;color:#1E66A4;font-size:16px;}")
self.alert.clicked.connect(self.alert.hide)
self.alert.hide()
def alert_msg(self, alertText):
self.ay = 380
self.ao = 0.0
self.alertGOE.setOpacity(self.ao)
self.alert.setText(alertText)
self.alert.show()
self.alertTimer.start(12)
def slot_alert_step(self):
if(self.ao < 1):
self.ao += 0.015
self.alertGOE.setOpacity(self.ao)
if(self.ay <= 250):
self.alertTimer.stop()
# close after * second
self.alertDelayTimer.start(4000)
else:
self.ay -= 2
self.alert.move(self.alert.x(), self.ay)
def slot_hide_alert(self):
self.alert.hide()
self.alertDelayTimer.stop() ubuntu-kylin-software-center-0.2.9.2/ui/reviewwidget.py 0000664 0000000 0000000 00000006323 12321543450 020025 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ui.ukcmtw import Ui_CommentWidget
from ui.starwidget import StarWidget
class ReviewWidget(QWidget):
def __init__(self, review, parent=None):
QWidget.__init__(self,parent)
self.ui_init()
self.star = StarWidget('small', review.rating, self)
self.star.move(719, 42)
self.ui.comment.setAlignment(Qt.AlignVCenter)
self.ui.comment.setWordWrap(True)
self.ui.userName.setStyleSheet("QLabel{color:#1E66A4;font-size:14px;}")
self.ui.userHead.setStyleSheet("QLabel{background-image:url('res/userhead.png')}")
self.ui.createDate.setStyleSheet("QLabel{color:#9AA2AF;font-size:13px;}")
self.ui.commentBG.setStyleSheet("QLabel{background-image:url('res/commentbg.png')}")
self.ui.userName.setText(review.reviewer_username)
self.ui.createDate.setText(review.date_created)
self.ui.comment.setText(review.review_text)
def ui_init(self):
self.ui = Ui_CommentWidget()
self.ui.setupUi(self)
self.show()
def changeGrade(self, grade):
if(self.size == 'small'):
if(grade > 0):
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 1):
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 2):
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 3):
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(grade > 4):
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-small-1.png')}")
if(self.size == 'big'):
if(grade > 0):
self.ui.star1.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 1):
self.ui.star2.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 2):
self.ui.star3.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 3):
self.ui.star4.setStyleSheet("QLabel{background-image:url('res/star-1.png')}")
if(grade > 4):
self.ui.star5.setStyleSheet("QLabel{background-image:url('res/star-1.png')}") ubuntu-kylin-software-center-0.2.9.2/ui/taskw.ui 0000664 0000000 0000000 00000002126 12321543450 016433 0 ustar
TaskWidget
0
0
805
479
Form
0
55
805
24
0
79
805
400
0
0
805
55
ubuntu-kylin-software-center-0.2.9.2/backend/ 0000775 0000000 0000000 00000000000 12322543236 015717 5 ustar ubuntu-kylin-software-center-0.2.9.2/backend/__init__.py 0000664 0000000 0000000 00000001351 12321543450 020025 0 ustar # -*- coding: utf-8 -*
# Copyright (C) 2014 Ubuntu Kylin
#
# Authors:
# maclin(majun@ubuntukylin.com)
#
# 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; version 3.
#
# 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, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
ubuntu-kylin-software-center-0.2.9.2/backend/sourcelist.py 0000664 0000000 0000000 00000005152 12321543450 020465 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# Shine Huang
# Maintainer:
# Shine Huang
# 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 .
import aptsources.sourceslist
class SourceList:
# get all source item in /etc/apt/sources.list
def get_sources(self):
slist = []
source = aptsources.sourceslist.SourcesList()
for one in source.list:
if(one.disabled == False and one.type != ""):
slist.append(one)
return slist
def get_sources_except_ubuntu(self):
slist = []
source = aptsources.sourceslist.SourcesList()
for one in source.list:
if(one.disabled == False and one.type != "" and one.str().find(".ubuntu.com/ubuntu") == -1):
slist.append(one)
return slist
# add source into /etc/apt/sources.list
def add_source(self, text):
source = aptsources.sourceslist.SourcesList()
for item in source.list:
if(item.str().find(text) != -1):
return
slist = text.split()
if(len(slist) < 3): # wrong source text
return
type = slist[0]
uri = slist[1]
dist = slist[2]
comps = []
for i in range(3, len(slist)):
comps.append(slist[i])
source.add(type, uri, dist, comps)
source.save()
# remove source from /etc/apt/sources.list
def remove_source(self, text):
source = aptsources.sourceslist.SourcesList()
sources = source.list
for item in sources:
if(item.str().find(text) != -1):
source.remove(item)
source.save()
def main():
sl = SourceList()
l = sl.get_sources()
one = l[4]
print one.uri
print one.invalid
print one.disabled
print one.type
print one.dist
print one.comps
print one.comment
print one.line
print one.str()
if __name__ == "__main__":
main() ubuntu-kylin-software-center-0.2.9.2/backend/installbackend.py 0000664 0000000 0000000 00000015540 12322541743 021255 0 ustar #!/usr/bin/python
# -*- coding: utf-8 -*
### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
# Author:
# maclin
# Maintainer:
# maclin
# 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 .
### END LICENSE
import dbus
import os
import locale
from PyQt4.QtCore import *
from PyQt4 import QtDBus
from models.enums import (UBUNTUKYLIN_SERVICE_PATH,
UBUNTUKYLIN_INTERFACE_PATH,
AppActions,
Signals,
AptActionMsg,
AptProcessMsg,
UnicodeToAscii)
import multiprocessing
from dbus.mainloop.glib import DBusGMainLoop
mainloop = DBusGMainLoop(set_as_default=True)
#from dbus.mainloop.qt import DBusQtMainLoop
#mainloop = DBusQtMainLoop()
class InstallBackend(QObject):
def __init__(self):
QObject.__init__(self)
locale.setlocale(locale.LC_ALL, "zh_CN.UTF-8")
self.iface = None
def init_dbus_ifaces(self):
try:
bus = dbus.SystemBus(mainloop)
except:
print "could not initiate dbus"
self.emit(Signals.init_models_ready,"fail","初始化失败!")
return False
try:
obj = bus.get_object(UBUNTUKYLIN_SERVICE_PATH,
'/',
UBUNTUKYLIN_INTERFACE_PATH)
#proxy = dbus.ProxyObject(obj,UBUNTUKYLIN_INTERFACE_PATH)
self.iface = dbus.Interface(obj, UBUNTUKYLIN_INTERFACE_PATH)
# self.call_dbus_iface("check_source_ubuntukylin")
self.iface.connect_to_signal("software_fetch_signal",self._on_software_fetch_signal)
self.iface.connect_to_signal("software_apt_signal",self._on_software_apt_signal)
self.iface.connect_to_signal("software_auth_signal",self._on_software_auth_signal)
except dbus.DBusException:
# bus_name = dbus.service.BusName('com.ubuntukylin.softwarecenter', bus)
# self.dbusControler = SoftwarecenterDbusController(self, bus_name)
self.emit(Signals.init_models_ready,"fail","初始化失败!")
print "dbus.DBusException error"
return False
return True
#call the dbus functions by function name
def call_dbus_iface(self, funcname, kwargs=None):
if self.iface is None:
return None
func = getattr(self.iface,funcname)
if func is None:
return None
res = None
try:
res = func(kwargs)
except dbus.DBusException:
return None
return res
def _on_software_fetch_signal(self, type, kwarg):
sendType = "fetch"
appname = str(kwarg['download_appname'])
percent = float(str(kwarg['download_percent']))
action = str(kwarg['action'])
sendMsg = AptProcessMsg[str(type)]
if( type == "down_pulse"):
sizepercent = str(int(kwarg['download_bytes'])/1024) + "/" + str(int(kwarg['total_bytes'])/1024)
itempercent = str(int(kwarg['download_items'])) + "/" + str(int(kwarg['total_items']))
sendMsg = sendMsg + "(" + sizepercent + ")" + "(" + itempercent + ")"
if(type == "down_cancel"):
sendType = "cancel"
# sendMsg = "操作取消"
percent = -1
self.emit(Signals.dbus_apt_process,appname,sendType,action,percent,sendMsg)
def _on_software_apt_signal(self,type, kwarg):
sendType = "apt"
appname = str(kwarg['apt_appname'])
sendMsg = ""
percent = float(str(kwarg['apt_percent']))
action = str(kwarg['action'])
sendMsg = AptActionMsg[action] + AptProcessMsg[str(type)]
# if(type == "apt_pulse"):
# sendMsg = sendMsg + kwarg['status']
# print kwarg['status']
# if( type == "apt_start"):
# sendMsg = "安装开始..."
# if( type == "apt_finish"):
# percent = 200
# sendMsg = "安装完成!"
# if( type == "apt_error"):
# sendMsg = "安装失败!"
# if( type == "apt_pulse"):
# sendMsg = "安装中..." + str(kwarg['status'])
self.emit(Signals.dbus_apt_process,appname,sendType,action,percent,sendMsg)
def _on_software_auth_signal(self,type, kwarg):
sendType = "auth"
appname = str(kwarg['appname'])
sendMsg = "操作取消"
action = str(kwarg['action'])
if type == "auth_cancel":
sendType = "cancel"
self.emit(Signals.dbus_apt_process,appname,sendType,action,0,sendMsg)
def install_package(self,pkgname):
return self.call_dbus_iface(AppActions.INSTALL,pkgname)
def remove_package(self,pkgname):
return self.call_dbus_iface(AppActions.REMOVE,pkgname)
def upgrade_package(self,pkgname):
return self.call_dbus_iface(AppActions.UPGRADE,pkgname)
def cancel_package(self,pkgname):
return self.call_dbus_iface(AppActions.CANCEL,pkgname)
def update_source(self,quiet=False):
return self.call_dbus_iface(AppActions.UPDATE,False)
def add_source(self,text):
return self.call_dbus_iface(AppActions.ADD_SOURCE,text)
def remove_source(self,text):
return self.call_dbus_iface(AppActions.REMOVE_SOURCE,text)
def get_sources(self,except_ubuntu):
list = self.call_dbus_iface(AppActions.GET_SOURCES,except_ubuntu)
resList = []
if list is None:
return resList
for item in list:
newitem = UnicodeToAscii(item)
resList.append(newitem)
return resList
from PyQt4.QtGui import *
import sys
def main():
app = QApplication(sys.argv)
w = QWidget()
w.setWindowTitle("测试")
w.setMaximumSize(320,240)
w.setMinimumSize(320,240)
w.resize(320,240)
instBackend = InstallBackend()
instBackend.init_dbus_ifaces()
instBackend.call_dbus_iface(AppActions.INSTALL,"gimp")
# instBackend.call_dbus_iface(AppActions.INSTALL,"gimp")
# instBackend.call_dbus_iface(AppActions.INSTALL,"bareftp")
# instBackend.call_dbus_iface(UK_DBUS_METHOD.INSTALL,"gimp")
# instBackend.call_dbus_iface(UK_DBUS_METHOD.INSTALL,"gimp")
w.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
ubuntu-kylin-software-center-0.2.9.2/backend/piston/ 0000775 0000000 0000000 00000000000 12322543236 017233 5 ustar ubuntu-kylin-software-center-0.2.9.2/backend/piston/__init__.py 0000664 0000000 0000000 00000000000 12321543450 021327 0 ustar ubuntu-kylin-software-center-0.2.9.2/backend/piston/rnrclient_pristine.py 0000664 0000000 0000000 00000015641 12321543450 023526 0 ustar """This module provides the RatingsAndReviewsAPI class for talking to the
ratings and reviews API, plus a few helper classes.
"""
from urllib import quote_plus
from piston_mini_client import (
PistonAPI,
PistonResponseObject,
PistonSerializable,
returns,
returns_json,
returns_list_of,
)
from piston_mini_client.validators import validate_pattern, validate
#import pdb
# These are factored out as constants for if you need to work against a
# server that doesn't support both schemes (like http-only dev servers)
PUBLIC_API_SCHEME = 'http'
AUTHENTICATED_API_SCHEME = 'https'
class ReviewRequest(PistonSerializable):
"""A review request.
Instantiate one of these objects to describe a new review you wish to
submit, then pass it in as an argument to submit_review().
"""
_atts = ('app_name', 'package_name', 'summary', 'version', 'review_text',
'rating', 'language', 'origin', 'distroseries', 'arch_tag')
app_name = ''
class ReviewsStats(PistonResponseObject):
"""A ratings summary for a package/app.
This class will be automatically populated with JSON retrieved from the
server. Each ReviewStats object will have the following fields:
* package_name
* app_name
* ratings_total
* ratings_average
"""
pass
class ReviewDetails(PistonResponseObject):
"""A detailed review description.
This class will be automatically populated with JSON retrieved from the
server. Each ReviewDetails object will have the following fields:
* id
* package_name
* app_name
* language
* date_created
* rating
* reviewer_username
* summary
* review_text
* hide
* version
"""
pass
class RatingsAndReviewsAPI(PistonAPI):
"""A client for talking to the reviews and ratings API.
If you pass no arguments into the constructor it will try to connect to
localhost:8000 so you probably want to at least pass in the
``service_root`` constructor argument.
"""
default_service_root = 'http://localhost:8000/reviews/api/1.0'
default_content_type = 'application/x-www-form-urlencoded'
@returns_json
def server_status(self):
"""Check the state of the server, to see if everything's ok."""
return self._get('server-status/', scheme=PUBLIC_API_SCHEME)
@validate_pattern('origin', r'[0-9a-z+-.:/]+', required=False)
@validate_pattern('distroseries', r'\w+', required=False)
@validate('days', int, required=False)
@returns_list_of(ReviewsStats)
def review_stats(self, origin='any', distroseries='any', days=None,
valid_days=(1, 3, 7)):
"""Fetch ratings for a particular distroseries"""
url = 'review-stats/{0}/{1}/'.format(origin, distroseries)
if days is not None:
# the server only knows valid_days (1,3,7) currently
for valid_day in valid_days:
# pick the day from valid_days that is the next bigger than
# days
if days <= valid_day:
url += 'updates-last-{0}-days/'.format(valid_day)
break
return self._get(url, scheme=PUBLIC_API_SCHEME)
@validate_pattern('language', r'\w+', required=False)
@validate_pattern('origin', r'[0-9a-z+-.:/]+', required=False)
@validate_pattern('distroseries', r'\w+', required=False)
@validate_pattern('version', r'[-\w+.:~]+', required=False)
@validate_pattern('packagename', r'[a-z0-9.+-]+')
@validate('appname', str, required=False)
@validate('page', int, required=False)
@validate('sort', str, required=False)
@returns_list_of(ReviewDetails)
def get_reviews(self, packagename, language='any', origin='any',
distroseries='any', version='any', appname='', page=1, sort='helpful'):
"""Fetch ratings and reviews for a particular package name.
If any of the optional arguments are provided, fetch reviews for that
particular app, language, origin, distroseries or version.
"""
# pdb.set_trace()
if appname:
appname = quote_plus(';' + appname)
urls = 'reviews/filter/%s/%s/%s/%s/%s%s/page/%s/%s/' % (
language, origin, distroseries, version, packagename,
appname, page, sort)
return self._get('reviews/filter/%s/%s/%s/%s/%s%s/page/%s/%s/' % (
language, origin, distroseries, version, packagename,
appname, page, sort),
scheme=PUBLIC_API_SCHEME)
@validate('review_id', int)
@returns(ReviewDetails)
def get_review(self, review_id):
"""Fetch a particular review via its id."""
return self._get('reviews/%s/' % review_id)
@validate('review', ReviewRequest)
@returns(ReviewDetails)
def submit_review(self, review):
"""Submit a rating/review."""
return self._post('reviews/', data=review,
scheme=AUTHENTICATED_API_SCHEME, content_type='application/json')
@validate('review_id', int)
@validate_pattern('reason', r'[^\n]+')
@validate_pattern('text', r'[^\n]+')
@returns_json
def flag_review(self, review_id, reason, text):
"""Flag a review as being inappropriate"""
data = {'reason': reason,
'text': text,
}
return self._post('reviews/%s/flags/' % review_id, data=data,
scheme=AUTHENTICATED_API_SCHEME)
@validate('review_id', int)
@validate_pattern('useful', 'True|False')
@returns_json
def submit_usefulness(self, review_id, useful):
"""Submit a usefulness vote."""
return self._post('/reviews/%s/recommendations/' % review_id,
data={'useful': useful}, scheme=AUTHENTICATED_API_SCHEME)
@validate('review_id', int, required=False)
@validate_pattern('username', r'[^\n]+', required=False)
@returns_json
def get_usefulness(self, review_id=None, username=None):
"""Get a list of usefulness filtered by username/review_id"""
if not username and not review_id:
return None
data = {}
if username:
data['username'] = username
if review_id:
data['review_id'] = str(review_id)
return self._get('usefulness/', args=data,
scheme=PUBLIC_API_SCHEME)
@validate('review_id', int)
@returns_json
def delete_review(self, review_id):
"""Delete a review"""
return self._post('/reviews/delete/%s/' % review_id, data={},
scheme=AUTHENTICATED_API_SCHEME)
@validate('review_id', int)
@validate('rating', int)
@validate_pattern('summary', r'[^\n]+')
@validate('review_text', str)
@returns(ReviewDetails)
def modify_review(self, review_id, rating, summary, review_text):
"""Modify an existing review"""
data = {
'rating': rating,
'summary': summary,
'review_text': review_text
}
return self._put('/reviews/modify/%s/' % review_id, data=data,
scheme=AUTHENTICATED_API_SCHEME)
ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/ 0000775 0000000 0000000 00000000000 12322543236 017667 5 ustar ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/conf/ 0000775 0000000 0000000 00000000000 12322543236 020614 5 ustar ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/conf/com.ubuntukylin.softwarecenter.policy 0000664 0000000 0000000 00000001446 12321543450 030237 0 ustar
Ubuntu Kylin Software Center
http://ubuntukylin.com
uksoftwarecenter
<_description>
authorization for package management
<_message>
To install/uninstall/update/... the pakcages, you need to authenticate.
auth_admin
auth_admin
auth_admin_keep
ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/conf/com.ubuntukylin.softwarecenter.conf 0000664 0000000 0000000 00000001544 12321543450 027664 0 ustar
ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/conf/com.ubuntukylin.softwarecenter.service 0000664 0000000 0000000 00000000160 12321543450 030370 0 ustar [D-BUS Service]
Name=com.ubuntukylin.softwarecenter
Exec=/usr/bin/ubuntu-kylin-software-center-daemon
User=root
ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/keyrings/ 0000775 0000000 0000000 00000000000 12322543236 021522 5 ustar ubuntu-kylin-software-center-0.2.9.2/backend/aptdaemon/keyrings/ubuntukylin-archive-keyring.gpg 0000664 0000000 0000000 00000004271 12321543450 027700 0 ustar
Q {,
O~\KӈWÑ(O ڷpж#kAY*
WO ?ݖ=