-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
358 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#! /usr/bin/env python | ||
# coding=utf-8 | ||
############################################################################# | ||
# # | ||
# File: gui.pyw # | ||
# # | ||
# Copyright (C) 2008 Du XiaoGang <[email protected]> # | ||
# # | ||
# Home: http://gappproxy.googlecode.com # | ||
# # | ||
# This file is part of GAppProxy. # | ||
# # | ||
# GAppProxy is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU General Public License as # | ||
# published by the Free Software Foundation, either version 3 of the # | ||
# License, or (at your option) any later version. # | ||
# # | ||
# GAppProxy 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 GAppProxy. If not, see <http://www.gnu.org/licenses/>. # | ||
# # | ||
############################################################################# | ||
|
||
import sys | ||
from PyQt4 import QtCore, QtGui | ||
from mainform_ui import Ui_MainForm | ||
|
||
class MainForm(QtGui.QMainWindow): | ||
def __init__(self, parent=None): | ||
QtGui.QWidget.__init__(self) | ||
self.ui = Ui_MainForm() | ||
self.ui.setupUi(self) | ||
self.setWindowIcon(QtGui.QIcon('./images/gap.png')) | ||
# create trayIcon | ||
self.createActions() | ||
self.createTrayIcon() | ||
# event process | ||
QtCore.QObject.connect(self.ui.hideButton, \ | ||
QtCore.SIGNAL('clicked()'), \ | ||
self.hideMainForm) | ||
QtCore.QObject.connect(self.ui.upgradeButton, \ | ||
QtCore.SIGNAL('clicked()'), \ | ||
self.checkNewVersion) | ||
QtCore.QObject.connect(self.ui.aboutButton, \ | ||
QtCore.SIGNAL('clicked()'), \ | ||
self.showAboutDlg) | ||
QtCore.QObject.connect(self.ui.quitButton, \ | ||
QtCore.SIGNAL('clicked()'), \ | ||
self.close) | ||
|
||
def createActions(self): | ||
self.restoreAction = QtGui.QAction('Restore', self) | ||
QtCore.QObject.connect(self.restoreAction, | ||
QtCore.SIGNAL('triggered()'), | ||
self.showMainForm) | ||
|
||
def createTrayIcon(self): | ||
# menu for trayIcon | ||
self.trayIconMenu = QtGui.QMenu(self) | ||
self.trayIconMenu.addAction(self.restoreAction) | ||
# trayIcon | ||
self.trayIcon = QtGui.QSystemTrayIcon(self) | ||
self.trayIcon.setContextMenu(self.trayIconMenu) | ||
self.trayIcon.setIcon(QtGui.QIcon('./images/gap.png')) | ||
self.trayIcon.setToolTip('GAppProxy') | ||
|
||
def hideMainForm(self): | ||
self.hide() | ||
self.trayIcon.show() | ||
|
||
def showMainForm(self): | ||
self.showNormal() | ||
self.trayIcon.hide() | ||
|
||
def checkNewVersion(self): | ||
pass | ||
|
||
def showAboutDlg(self): | ||
QtGui.QMessageBox.information(self, 'About GAppProxy', | ||
'GAppProxy' | ||
'<p>' | ||
'License: GPLv3' | ||
'<p>' | ||
'Version: svn r35' | ||
'<p>' | ||
'Home: <a href="http://gappproxy.googlecode.com">GAppProxy</a>' | ||
'<p>' | ||
'Maintained by: <a href="mailto:[email protected]">DuGang</a>' | ||
' & <a href="mailto:[email protected]">WCM</a>') | ||
|
||
def closeEvent(self, event): | ||
r = QtGui.QMessageBox.question(self, 'Confirm', | ||
'Do you really want to quit?', | ||
QtGui.QMessageBox.Yes, | ||
QtGui.QMessageBox.Cancel) | ||
if r != QtGui.QMessageBox.Yes: | ||
event.ignore() | ||
|
||
if __name__ == '__main__': | ||
app = QtGui.QApplication(sys.argv) | ||
myapp = MainForm() | ||
myapp.show() | ||
sys.exit(app.exec_()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<ui version="4.0" > | ||
<class>MainForm</class> | ||
<widget class="QWidget" name="MainForm" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>161</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle" > | ||
<string>Form</string> | ||
</property> | ||
<widget class="QGroupBox" name="groupBox" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>10</x> | ||
<y>10</y> | ||
<width>381</width> | ||
<height>111</height> | ||
</rect> | ||
</property> | ||
<property name="title" > | ||
<string>GroupBox</string> | ||
</property> | ||
<widget class="QCheckBox" name="proxyCheckBox" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>10</x> | ||
<y>20</y> | ||
<width>90</width> | ||
<height>17</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>CheckBox</string> | ||
</property> | ||
</widget> | ||
<widget class="QLineEdit" name="proxyEdit" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>110</x> | ||
<y>20</y> | ||
<width>260</width> | ||
<height>20</height> | ||
</rect> | ||
</property> | ||
</widget> | ||
<widget class="QLineEdit" name="fetchserverEdit" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>110</x> | ||
<y>50</y> | ||
<width>260</width> | ||
<height>20</height> | ||
</rect> | ||
</property> | ||
</widget> | ||
<widget class="QCheckBox" name="fetchserverCheckBox" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>10</x> | ||
<y>50</y> | ||
<width>90</width> | ||
<height>17</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>CheckBox</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="applyButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>110</x> | ||
<y>80</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="saveButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>190</x> | ||
<y>80</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
</widget> | ||
<widget class="QPushButton" name="hideButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>40</x> | ||
<y>130</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="upgradeButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>120</x> | ||
<y>130</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="aboutButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>200</x> | ||
<y>130</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="quitButton" > | ||
<property name="geometry" > | ||
<rect> | ||
<x>280</x> | ||
<y>130</y> | ||
<width>75</width> | ||
<height>23</height> | ||
</rect> | ||
</property> | ||
<property name="text" > | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Form implementation generated from reading ui file 'mainform.ui' | ||
# | ||
# Created: Thu Oct 23 09:49:59 2008 | ||
# by: PyQt4 UI code generator 4.4.3 | ||
# | ||
# WARNING! All changes made in this file will be lost! | ||
|
||
from PyQt4 import QtCore, QtGui | ||
|
||
class Ui_MainForm(object): | ||
def setupUi(self, MainForm): | ||
MainForm.setObjectName("MainForm") | ||
MainForm.resize(400, 161) | ||
self.groupBox = QtGui.QGroupBox(MainForm) | ||
self.groupBox.setGeometry(QtCore.QRect(10, 10, 381, 111)) | ||
self.groupBox.setObjectName("groupBox") | ||
self.proxyCheckBox = QtGui.QCheckBox(self.groupBox) | ||
self.proxyCheckBox.setGeometry(QtCore.QRect(10, 20, 90, 17)) | ||
self.proxyCheckBox.setObjectName("proxyCheckBox") | ||
self.proxyEdit = QtGui.QLineEdit(self.groupBox) | ||
self.proxyEdit.setGeometry(QtCore.QRect(110, 20, 260, 20)) | ||
self.proxyEdit.setObjectName("proxyEdit") | ||
self.fetchserverEdit = QtGui.QLineEdit(self.groupBox) | ||
self.fetchserverEdit.setGeometry(QtCore.QRect(110, 50, 260, 20)) | ||
self.fetchserverEdit.setObjectName("fetchserverEdit") | ||
self.fetchserverCheckBox = QtGui.QCheckBox(self.groupBox) | ||
self.fetchserverCheckBox.setGeometry(QtCore.QRect(10, 50, 90, 17)) | ||
self.fetchserverCheckBox.setObjectName("fetchserverCheckBox") | ||
self.applyButton = QtGui.QPushButton(self.groupBox) | ||
self.applyButton.setGeometry(QtCore.QRect(110, 80, 75, 23)) | ||
self.applyButton.setObjectName("applyButton") | ||
self.saveButton = QtGui.QPushButton(self.groupBox) | ||
self.saveButton.setGeometry(QtCore.QRect(190, 80, 75, 23)) | ||
self.saveButton.setObjectName("saveButton") | ||
self.hideButton = QtGui.QPushButton(MainForm) | ||
self.hideButton.setGeometry(QtCore.QRect(40, 130, 75, 23)) | ||
self.hideButton.setObjectName("hideButton") | ||
self.upgradeButton = QtGui.QPushButton(MainForm) | ||
self.upgradeButton.setGeometry(QtCore.QRect(120, 130, 75, 23)) | ||
self.upgradeButton.setObjectName("upgradeButton") | ||
self.aboutButton = QtGui.QPushButton(MainForm) | ||
self.aboutButton.setGeometry(QtCore.QRect(200, 130, 75, 23)) | ||
self.aboutButton.setObjectName("aboutButton") | ||
self.quitButton = QtGui.QPushButton(MainForm) | ||
self.quitButton.setGeometry(QtCore.QRect(280, 130, 75, 23)) | ||
self.quitButton.setObjectName("quitButton") | ||
|
||
self.retranslateUi(MainForm) | ||
QtCore.QMetaObject.connectSlotsByName(MainForm) | ||
|
||
def retranslateUi(self, MainForm): | ||
MainForm.setWindowTitle(QtGui.QApplication.translate("MainForm", "Form", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.groupBox.setTitle(QtGui.QApplication.translate("MainForm", "GroupBox", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.proxyCheckBox.setText(QtGui.QApplication.translate("MainForm", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.fetchserverCheckBox.setText(QtGui.QApplication.translate("MainForm", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.applyButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.saveButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.hideButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.upgradeButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.aboutButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
self.quitButton.setText(QtGui.QApplication.translate("MainForm", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# local proxy | ||
# | ||
# GAppProxy configuration | ||
|
||
# local_proxy | ||
#local_proxy = host:port | ||
# | ||
# If proxy needs authentication: | ||
# If local proxy needs authentication: | ||
#local_proxy = user:passwd@host:port | ||
local_proxy = www.google.cn:80 | ||
|
||
# fetch service | ||
# fetch server | ||
#fetch_server = http://127.0.0.1:8080/fetch.py | ||
#fetch_server = http://your-fetch-server.appspot.com/fetch.py | ||
#fetch_server = http://fetchserver-nolog.appspot.com/fetch.py | ||
fetch_server = dynamic |
Oops, something went wrong.