def mousePressEvent(self, event): self.origin = event.pos() self.moveSelection = False self.resizeSelection = False self.rotateSelection = False if self.app.keyboardModifiers() == Qt.ControlModifier: if self.res: item = self.res.gameFile.GetResourceName( CliClass.GameObject, self.roomWindow.activeItem) if item: inst = self.res.newInstance() inst.setMember("x", self.origin.x()) inst.setMember("y", self.origin.y()) inst.setMember("object", item) self.roomWindow.updateTree() return for c in reversed(self.children()): if type(c) == RoomViewInstance and c.geometry().contains( self.origin): if not c.selected: for chil in self.children(): if self.app.keyboardModifiers() != Qt.ShiftModifier: chil.selected = False chil.update() c.selected = True c.update() point = self.origin - c.geometry().topLeft() if QRect(0, 0, 8, 8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(c.containerWidth - 8, 0, 8, 8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(0, c.containerHeight - 8, 8, 8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(c.containerWidth - 8, c.containerHeight - 8, 8, 8).contains(point): self.resizeSelection = True return elif QRect(c.containerWidth - 8, (c.containerHeight - 8) / 2, 8, 8).contains(point): self.rotateSelection = True self.origin = QPoint(c.x() + (c.width() / 2), c.y() + (c.height() / 2)) self.moveSelection = True self.roomWindow.tree.setCurrentItem(c.qTreeWidgetItem) return self.rubberBand.setGeometry(QRect(self.origin, QSize())) self.rubberBand.show()
def mousePressEvent(self, event): self.origin = event.pos() self.moveSelection=False self.resizeSelection=False self.rotateSelection=False if self.app.keyboardModifiers() == Qt.ControlModifier: if self.res: item=self.res.gameFile.GetResourceName(CliClass.GameObject, self.roomWindow.activeItem) if item: inst=self.res.newInstance() inst.setMember("x",self.origin.x()) inst.setMember("y",self.origin.y()) inst.setMember("object",item) self.roomWindow.updateTree() return for c in reversed(self.children()): if type(c)==RoomViewInstance and c.geometry().contains(self.origin): if not c.selected: for chil in self.children(): if self.app.keyboardModifiers() != Qt.ShiftModifier: chil.selected=False chil.update() c.selected=True c.update() point = self.origin-c.geometry().topLeft() if QRect(0,0,8,8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(c.containerWidth-8,0,8,8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(0,c.containerHeight-8,8,8).contains(point): CliClass.print_notice("resize unsupported") elif QRect(c.containerWidth-8,c.containerHeight-8,8,8).contains(point): self.resizeSelection=True return elif QRect(c.containerWidth-8,(c.containerHeight-8)/2,8,8).contains(point): self.rotateSelection=True self.origin=QPoint(c.x()+(c.width()/2),c.y()+(c.height()/2)) self.moveSelection=True self.roomWindow.tree.setCurrentItem(c.qTreeWidgetItem) return self.rubberBand.setGeometry(QRect(self.origin, QSize())) self.rubberBand.show()
def saveResource(self): CliClass.print_warning("save resource unsupported " + str(self.res))
#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 sys import os bhex = hex from PyQt4 import QtGui, QtCore from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.Qsci import * import CliClass from IdeSciLexer import * resourcePath = os.path.join(CliClass.module_path(), "ideicons") + "/" stylePath = os.path.join(CliClass.module_path(), "styles") + "/" class ColorQTableWidgetItem(QTableWidgetItem): def __init__(self, item): QTableWidgetItem.__init__(self, item) class ResourceQComboBox(QComboBox): def __init__(self, parent, mainwindow, resourceClass, resSelected): QComboBox.__init__(self, parent) self.mainwindow = mainwindow if resourceClass == CliClass.GameSprite: resIcon = QIcon(resourcePath + "resources/sprite.png") self.addItem(resIcon, "none")
def saveResource(self): CliClass.print_warning("save resource unsupported "+str(self.res))
#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 sys import os bhex=hex from PyQt4 import QtGui, QtCore from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.Qsci import * import CliClass from IdeSciLexer import * resourcePath=os.path.join(CliClass.module_path(),"ideicons")+"/" stylePath=os.path.join(CliClass.module_path(),"styles")+"/" class ColorQTableWidgetItem(QTableWidgetItem): def __init__(self, item): QTableWidgetItem.__init__(self, item) class ResourceQComboBox(QComboBox): def __init__(self, parent, mainwindow, resourceClass, resSelected): QComboBox.__init__(self, parent) self.mainwindow=mainwindow if resourceClass==CliClass.GameSprite: resIcon=QIcon(resourcePath+"resources/sprite.png") self.addItem(resIcon, "none") for s in self.mainwindow.gmk.sprites: resIcon=s.getQIcon()