Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[PluginManager] Code cleanup: keep one class per file also in Python
- Loading branch information
1 parent
780772f
commit 780301c
Showing
9 changed files
with
183 additions
and
108 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
Empty file.
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
Empty file.
82 changes: 82 additions & 0 deletions
82
python/pyplugin_installer/qgsplugininstallerfetchingdialog.py
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,82 @@ | ||
# -*- coding:utf-8 -*- | ||
""" | ||
/*************************************************************************** | ||
qgsplugininstallerfetchingdialog.py | ||
Plugin Installer module | ||
------------------- | ||
Date : June 2013 | ||
Copyright : (C) 2013 by Borys Jurgiel | ||
Email : info at borysjurgiel dot pl | ||
This module is based on former plugin_installer plugin: | ||
Copyright (C) 2007-2008 Matthew Perry | ||
Copyright (C) 2008-2013 Borys Jurgiel | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* 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; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
""" | ||
|
||
import sys | ||
import time | ||
|
||
from PyQt4.QtGui import * | ||
|
||
from ui_qgsplugininstallerfetchingbase import Ui_QgsPluginInstallerFetchingDialogBase | ||
from installer_data import * | ||
|
||
|
||
|
||
|
||
class QgsPluginInstallerFetchingDialog(QDialog, Ui_QgsPluginInstallerFetchingDialogBase): | ||
# ----------------------------------------- # | ||
def __init__(self, parent): | ||
QDialog.__init__(self, parent) | ||
self.setupUi(self) | ||
self.progressBar.setRange(0,len(repositories.allEnabled())*100) | ||
self.itemProgress = {} | ||
self.item = {} | ||
for key in repositories.allEnabled(): | ||
self.item[key] = QTreeWidgetItem(self.treeWidget) | ||
self.item[key].setText(0,key) | ||
if repositories.all()[key]["state"] > 1: | ||
self.itemProgress[key] = 100 | ||
self.displayState(key,0) | ||
else: | ||
self.itemProgress[key] = 0 | ||
self.displayState(key,2) | ||
self.treeWidget.resizeColumnToContents(0) | ||
repositories.repositoryFetched.connect(self.repositoryFetched) | ||
repositories.anythingChanged.connect(self.displayState) | ||
|
||
|
||
# ----------------------------------------- # | ||
def displayState(self,key,state,state2=None): | ||
messages=[self.tr("Success"),self.tr("Resolving host name..."),self.tr("Connecting..."),self.tr("Host connected. Sending request..."),self.tr("Downloading data..."),self.tr("Idle"),self.tr("Closing connection..."),self.tr("Error")] | ||
message = messages[state] | ||
if state2: | ||
message += " (%s%%)" % state2 | ||
self.item[key].setText(1,message) | ||
|
||
if state == 4 and state2: | ||
self.itemProgress[key] = state2 | ||
totalProgress = sum(self.itemProgress.values()) | ||
self.progressBar.setValue(totalProgress) | ||
|
||
|
||
# ----------------------------------------- # | ||
def repositoryFetched(self, repoName): | ||
self.itemProgress[repoName] = 100 | ||
if repositories.all()[repoName]["state"] == 2: | ||
self.displayState(repoName,0) | ||
else: | ||
self.displayState(repoName,7) | ||
if not repositories.fetchingInProgress(): | ||
self.close() |
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
41 changes: 41 additions & 0 deletions
41
python/pyplugin_installer/qgsplugininstallerpluginerrordialog.py
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,41 @@ | ||
# -*- coding:utf-8 -*- | ||
""" | ||
/*************************************************************************** | ||
qgsplugininstallerpluginerrordialog.py | ||
Plugin Installer module | ||
------------------- | ||
Date : June 2013 | ||
Copyright : (C) 2013 by Borys Jurgiel | ||
Email : info at borysjurgiel dot pl | ||
This module is based on former plugin_installer plugin: | ||
Copyright (C) 2007-2008 Matthew Perry | ||
Copyright (C) 2008-2013 Borys Jurgiel | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* 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; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
""" | ||
|
||
from PyQt4.QtGui import * | ||
|
||
from ui_qgsplugininstallerpluginerrorbase import Ui_QgsPluginInstallerPluginErrorDialogBase | ||
|
||
|
||
|
||
|
||
class QgsPluginInstallerPluginErrorDialog(QDialog, Ui_QgsPluginInstallerPluginErrorDialogBase): | ||
# ----------------------------------------- # | ||
def __init__(self, parent, errorMessage): | ||
QDialog.__init__(self, parent) | ||
self.setupUi(self) | ||
if not errorMessage: | ||
errorMessage = self.tr("no error message received") | ||
self.textBrowser.setText(errorMessage) |
47 changes: 47 additions & 0 deletions
47
python/pyplugin_installer/qgsplugininstallerrepositorydialog.py
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,47 @@ | ||
# -*- coding:utf-8 -*- | ||
""" | ||
/*************************************************************************** | ||
qgsplugininstallerrepositorydialog.py | ||
Plugin Installer module | ||
------------------- | ||
Date : June 2013 | ||
Copyright : (C) 2013 by Borys Jurgiel | ||
Email : info at borysjurgiel dot pl | ||
This module is based on former plugin_installer plugin: | ||
Copyright (C) 2007-2008 Matthew Perry | ||
Copyright (C) 2008-2013 Borys Jurgiel | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* 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; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
""" | ||
|
||
from PyQt4.QtGui import * | ||
|
||
from ui_qgsplugininstallerrepositorybase import Ui_QgsPluginInstallerRepositoryDetailsDialogBase | ||
|
||
|
||
|
||
|
||
class QgsPluginInstallerRepositoryDialog(QDialog, Ui_QgsPluginInstallerRepositoryDetailsDialogBase): | ||
# ----------------------------------------- # | ||
def __init__(self, parent=None): | ||
QDialog.__init__(self, parent) | ||
self.setupUi(self) | ||
self.editURL.setText("http://") | ||
self.editName.textChanged.connect(self.textChanged) | ||
self.editURL.textChanged.connect(self.textChanged) | ||
self.textChanged(None) | ||
|
||
# ----------------------------------------- # | ||
def textChanged(self, string): | ||
enable = (len(self.editName.text()) > 0 and len(self.editURL.text()) > 0) | ||
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
Empty file.