Added code to load UI files from package
This commit is contained in:
parent
4ade07d9e0
commit
a8b3ae57c7
@ -14,10 +14,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
from PyQt4 import QtGui, uic
|
||||
|
||||
import resources
|
||||
|
||||
class DialogAbout(QtGui.QDialog):
|
||||
def __init__(self, parent):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
ui = uic.loadUi('dev/ui/about.ui', self)
|
||||
ui = uic.loadUi(os.path.join(resources.get_ui_path(), 'about.ui'), self)
|
||||
|
@ -14,16 +14,16 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import os
|
||||
import os, os.path
|
||||
from PyQt4 import QtGui, QtCore, QtXml, uic
|
||||
|
||||
import image
|
||||
import resources
|
||||
from image import ImageFlags
|
||||
from about import DialogAbout
|
||||
from options import DialogOptions
|
||||
from convert import DialogConvert
|
||||
|
||||
|
||||
class Book:
|
||||
DefaultDevice = 'Kindle 3'
|
||||
DefaultOverwrite = True
|
||||
@ -107,7 +107,7 @@ class Book:
|
||||
class MainWindowBook(QtGui.QMainWindow):
|
||||
def __init__(self, filename=None):
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
ui = uic.loadUi('dev/ui/book.ui', self)
|
||||
ui = uic.loadUi(os.path.join(resources.get_ui_path(), 'book.ui'), self)
|
||||
self.connect(self.actionFileNew, QtCore.SIGNAL('triggered()'), self.onFileNew)
|
||||
self.connect(self.actionFileOpen, QtCore.SIGNAL('triggered()'), self.onFileOpen)
|
||||
self.connect(self.actionFileSave, QtCore.SIGNAL('triggered()'), self.onFileSave)
|
||||
|
@ -13,17 +13,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path
|
||||
|
||||
from PyQt4 import QtGui, QtCore, uic
|
||||
|
||||
from image import ImageFlags
|
||||
import resources
|
||||
|
||||
|
||||
class DialogOptions(QtGui.QDialog):
|
||||
def __init__(self, parent, book):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.book = book
|
||||
ui = uic.loadUi('dev/ui/options.ui', self)
|
||||
ui = uic.loadUi(os.path.join(resources.get_ui_path(), 'options.ui'), self)
|
||||
self.connect(self, QtCore.SIGNAL('accepted()'), self.onAccept)
|
||||
self.moveOptionsToDialog()
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2011 Marek Kubica <marek@xivilization.net>
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path
|
||||
|
||||
def get_resource_path():
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
def get_ui_path():
|
||||
return os.path.join(get_resource_path(), 'ui')
|
||||
|
||||
def get_image_path():
|
||||
return os.path.join(get_resource_path(), 'images')
|
Loading…
Reference in New Issue
Block a user