# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_viewer_vector_options_dialog_widget')


def float_safe(txt):
    """ convert to float, return 0 if conversion is not possible """
    try:
        return float(txt)
    except ValueError:
        return 0.


class CrayfishViewerVectorOptionsDialog(qtBaseClass, uiDialog):
    def __init__(self, iface, renderSettings, redrawFunction, parent=None):
        qtBaseClass.__init__(self)
        uiDialog.__init__(self, parent)
コード例 #2
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsApplication, QgsStyleV2

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_colormap_dialog')

from crayfish import ColorMap, qcolor2rgb, rgb2qcolor

from crayfish_gui_utils import initColorRampComboBox, name2ramp


class ValueDelegate(QStyledItemDelegate):
    def __init__(self, parent=None):
        QStyledItemDelegate.__init__(self, parent)

    def createEditor(self, parent, option, index):
        w = QStyledItemDelegate.createEditor(self, parent, option, index)
        if isinstance(w, QDoubleSpinBox):
            w.setDecimals(5)
        return w
コード例 #3
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from qgis.core import *


from crayfish_install_helper import plugin_version_str

import os

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_about_dialog_widget')

class CrayfishAboutDialog(qtBaseClass, uiDialog):

    def __init__(self, iface, activateNews=False):

        qtBaseClass.__init__(self)
        uiDialog.__init__(self)

        self.setupUi(self)
        self.iface = iface

        doc_dir = os.path.join(os.path.dirname(__file__), "doc")
        self.about_page = os.path.join(doc_dir, "about.html")
        self.news_page = os.path.join(doc_dir, "news.html")
コード例 #4
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from qgis.core import *

from crayfish_install_helper import plugin_version_str

import os

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_about_dialog_widget')


class CrayfishAboutDialog(qtBaseClass, uiDialog):
    def __init__(self, iface, activateNews=False):

        qtBaseClass.__init__(self)
        uiDialog.__init__(self)

        self.setupUi(self)
        self.iface = iface

        doc_dir = os.path.join(os.path.dirname(__file__), "doc")
        self.about_page = os.path.join(doc_dir, "about.html")
        self.news_page = os.path.join(doc_dir, "news.html")
コード例 #5
0
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *

import platform
import os
import shutil
import tempfile

from crayfish_animation import animation, images_to_video
from crayfish_gui_utils import timeToString

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_animation_dialog_widget')


# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
def which(program):
    import os

    def is_exe(fpath):
        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

    fpath, fname = os.path.split(program)
    if fpath:
        if is_exe(program):
            return program
    else:
        for path in os.environ["PATH"].split(os.pathsep):
コード例 #6
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *

import crayfish_viewer_vector_options_dialog
from crayfish_viewer_render_settings import CrayfishViewerRenderSettings
from crayfish_gui_utils import initColorButton, initColorRampComboBox, name2ramp, timeToString
from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_viewer_dock_widget')


class CrayfishViewerDock(qtBaseClass, uiDialog):
    def __init__(self, iface):

        qtBaseClass.__init__(self)
        uiDialog.__init__(self)

        self.setupUi(self)
        self.setObjectName(
            "CrayfishViewerDock")  # used by main window to save/restore state
        self.iface = iface

        self.addIlluvisPromo()
コード例 #7
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsApplication, QgsStyleV2

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_colormap_dialog')

from crayfish import ColorMap, qcolor2rgb, rgb2qcolor

from crayfish_gui_utils import initColorRampComboBox, name2ramp

class ValueDelegate(QStyledItemDelegate):
    def __init__(self, parent=None):
        QStyledItemDelegate.__init__(self, parent)

    def createEditor(self, parent, option, index):
        w = QStyledItemDelegate.createEditor(self, parent, option, index)
        if isinstance(w, QDoubleSpinBox):
            w.setDecimals(5)
        return w
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsCoordinateReferenceSystem
from qgis.gui import QgsGenericProjectionSelector

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_viewer_plugin_layer_props_dialog')


class CrayfishViewerPluginPropsDialog(qtBaseClass, uiDialog):
    def __init__(self, layer):
        qtBaseClass.__init__(self)
        uiDialog.__init__(self)
        self.layer = layer

        self.setupUi(self)
        self.window().setWindowTitle('Layer Properties - %s' % (self.layer.name()))

        self.crs = self.layer.crs()

        m = self.layer.mesh
        ec4, ec3, ecx = 0, 0, 0
# of the License, or (at your option) any later version.

# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_animation_layout_item_props')


class AnimationLayoutItemProps(qtBaseClass, uiDialog):
    def __init__(self, iface, parent=None):
        qtBaseClass.__init__(self)
        uiDialog.__init__(self, parent)
        self.setupUi(self)

        self.btnFont.clicked.connect(self.onFontClicked)

    def setProps(self, props):

        self.prop_type = props['type']
        self.btnTextColor.setColor(props['text_color'])
        self.fnt = QFont(props['text_font'])  # need to make explicit copy
コード例 #10
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *

import crayfish_viewer_vector_options_dialog
from crayfish_viewer_render_settings import CrayfishViewerRenderSettings
from crayfish_gui_utils import initColorButton, initColorRampComboBox, name2ramp, timeToString
from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_viewer_dock_widget')

class CrayfishViewerDock(qtBaseClass, uiDialog):

    def __init__(self, iface):

        qtBaseClass.__init__(self)
        uiDialog.__init__(self)

        self.setupUi(self)
        self.setObjectName("CrayfishViewerDock") # used by main window to save/restore state
        self.iface = iface

        self.addIlluvisPromo()

        self.plot_dock_widget = None
コード例 #11
0
# of the License, or (at your option) any later version.

# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_export_config_dialog')

class CrayfishExportConfigDialog(qtBaseClass, uiDialog):
    def __init__(self, parent=None):
        qtBaseClass.__init__(self)
        uiDialog.__init__(self, parent)

        self.setupUi(self)

        s = QSettings()
        self.spinResolution.setValue( float(s.value("crayfish/exportResolution", 10)) )
        self.chkAddToCanvas.setChecked( int(s.value("crayfish/exportAddToCanvas", 1)) )

    def saveSettings(self):
        s = QSettings()
        s.setValue("crayfish/exportResolution", self.resolution())
コード例 #12
0
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *

import platform
import os
import shutil
import tempfile

from crayfish_animation import animation, images_to_video
from crayfish_gui_utils import timeToString

from crayfish_ui_loader import load_ui
uiDialog, qtBaseClass = load_ui('crayfish_animation_dialog_widget')

# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
def which(program):
    import os
    def is_exe(fpath):
        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

    fpath, fname = os.path.split(program)
    if fpath:
        if is_exe(program):
            return program
    else:
        for path in os.environ["PATH"].split(os.pathsep):
            path = path.strip('"')
            exe_file = os.path.join(path, program)
コード例 #13
0
# 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.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsCoordinateReferenceSystem
from qgis.gui import QgsGenericProjectionSelector

from crayfish_ui_loader import load_ui

uiDialog, qtBaseClass = load_ui('crayfish_viewer_plugin_layer_props_dialog')


class CrayfishViewerPluginPropsDialog(qtBaseClass, uiDialog):
    def __init__(self, layer):
        qtBaseClass.__init__(self)
        uiDialog.__init__(self)
        self.layer = layer

        self.setupUi(self)
        self.window().setWindowTitle('Layer Properties - %s' %
                                     (self.layer.name()))

        self.crs = self.layer.crs()

        m = self.layer.mesh