Skip to content

Commit

Permalink
branch merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerf committed Feb 27, 2012
2 parents 41f0ed7 + 5ccbdca commit 00d7a0e
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/controllers/debugcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def __init__(self, distributedObjects):
def openExecutable(self, filename):
# die if the file does not exist or has been provided without at least a
# relative path; files without a path work with pythons os.* functions
# but fail in gdb, so do an extra check for those
if not (os.path.exists(filename) or os.path.dirname(filename) == ""):
# but fail in gdb, so do an extra check for those
if not os.path.exists(filename) or os.path.dirname(filename) == "":
logging.error("File %s was not found." % filename)
return
if (self.editorController.closeOpenedFiles()): #closing source files may be canceled by user

if self.editorController.closeOpenedFiles(): #closing source files may be canceled by user
if self.executableName != None:
#clear variables, tracepoints, watches,... by connecting to this signal
self.signalProxy.emitCleanupModels()
Expand Down
4 changes: 4 additions & 0 deletions src/datagraph/datagraphvw.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def render(self, role, **kwargs):
def openContextMenu(self):
self.varWrapper.openContextMenu()

@QtCore.pyqtSlot(str)
def setValue(self, value):
self.varWrapper.variable.setValue(value)

def prepareContextMenu(self, menu):
menu.addSeparator()
self.addContextMenuLabel(menu)
Expand Down
7 changes: 1 addition & 6 deletions src/datagraph/htmlvariableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ def __init__(self, varWrapper, distributedObjects):
QGraphicsWebView.__init__(self, None)
self.varWrapper = varWrapper
self.distributedObjects = distributedObjects
self.setFlags(QGraphicsItem.ItemIsMovable)
self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsFocusable)
self.htmlTemplate = Template(filename=sys.path[0] + '/datagraph/templates/htmlvariableview.mako')
self.page().setPreferredContentsSize(QSize(0, 0))
self.setPreferredSize(QSizeF(0, 0))
self.setResizesToContents(True)
self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
self.connect(self.page(), SIGNAL('linkClicked(QUrl)'), self.linkClicked, Qt.DirectConnection)
self.incomingPointers = []
self.outgoingPointers = []

Expand Down Expand Up @@ -105,9 +103,6 @@ def render(self):

return self.source

def linkClicked(self, url):
self.handleCommand(str(url.toString()))

def openContextMenu(self, menu):
menu.addAction(QIcon(":/icons/images/minus.png"), "Remove %s" % self.varWrapper.getExp(), self.remove)
menu.addAction(QIcon(":/icons/images/save-html.png"), "Save HTML for %s" % self.varWrapper.getExp(), self.saveHtml)
Expand Down
12 changes: 6 additions & 6 deletions src/datagraph/templates/common.mako
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
%>\
<img src="qrc:icons/images/${iconprefix}${icon}">
% if varWrapper.getAccess():
<span class="varaccess"> ${varWrapper.getAccess()}</span>
<span class="varaccess"> ${varWrapper.getAccess() | h}</span>
% endif
</td>
<td nowrap class="vartype">
<span class="vartype"> ${varWrapper.getType()}</span>
<span class="vartype"> ${varWrapper.getType() | h}</span>
</td>
<td nowrap class="varname">
<span class="varname"> ${varWrapper.getExp()}</span>
<span class="varname"> ${varWrapper.getExp() | h}</span>
</td>
<td nowrap class="open_close">
% if openclose:
Expand All @@ -41,7 +41,7 @@
=
% endif
</td>
<td nowrap class="varvalue" id="${id_}value">
<td nowrap class="varvalue" id="${id_}value" ondblclick="showChangeInput('${id_}', '${id_}value')">
${caller.body()}\
</td>
</tr>
Expand All @@ -57,8 +57,8 @@
<tr class="header" id="${id}" oncontextmenu="contextmenu(${id}, '${id}')">
<td nowrap>
<img src="qrc:icons/images/${icon}">
<span class="vartype"> ${varWrapper.getType()}</span>
<span class="varname"> ${varWrapper.getExp()}</span>
<span class="vartype"> ${varWrapper.getType() | h}</span>
<span class="varname"> ${varWrapper.getExp() | h}</span>
${open_close_entry(id_, varWrapper)}
</td>
</tr>
Expand Down
10 changes: 10 additions & 0 deletions src/datagraph/templates/htmlvariableview.mako
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ div.removediv:hover {opacity:1;}
tr.header {background-color: rgba(240, 240, 240, 1); border: 0;}
a {border-bottom:1px dotted;}
* {-webkit-user-select: none; user-select: none; font-family: sans-serif;}
input {-webkit-user-select: text; user-select: text; border: 1px solid rgba(200, 200, 200, 1); }
form {margin: 0px; }
</style>
<script type="text/javascript">
function contextmenu(obj, id) {
Expand All @@ -31,6 +33,14 @@ function contextmenu(obj, id) {
event.stopPropagation();
document.getElementById(id).style.background = '';
}
function showChangeInput(obj, td) {
document.getElementById(td).innerHTML="<form onsubmit='setValue(" + obj + ", \"" + td + "\"); return false;'><input type='text' id='valueinput' value=" + document.getElementById(td).innerHTML + "></form>";
document.getElementById(td).ondblclick = null;
}
function setValue(obj, td) {
value = document.getElementById("valueinput").value;
obj.setValue(value);
}
</script>
<% assert(top) %>\
% if varWrapper.getInScope() == True:
Expand Down
2 changes: 1 addition & 1 deletion src/datagraph/templates/ptrvariableview.mako
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%namespace name="common" file="/common.mako"/>\
<%call expr="common.simple_entry(role, id, 'var.png', varWrapper)">
<a ondblclick="${id}.dereference()">${varWrapper.getValue()}</a>
<a ondblclick="${id}.dereference()">${varWrapper.getValue() | h}</a>
</%call>
2 changes: 1 addition & 1 deletion src/datagraph/templates/stdvariableview.mako
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%namespace name="common" file="/common.mako"/>\
<%call expr="common.simple_entry(role, id, 'var.png', varWrapper)">
${varWrapper.getValue()}
${varWrapper.getValue() | h}
</%call>
2 changes: 1 addition & 1 deletion src/datagraph/templates/structvariableview.mako
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% endfor
% else:
% for idx, childVW in enumerate(varWrapper.getChildren()):
<td nowrap title="${childVW.getAccess()} ${childVW.getType()} ${childVW.getExp()}" ${'class="withborder"' if idx != 0 else ''}>
<td nowrap title="${childVW.getAccess() | h} ${childVW.getType() | h} ${childVW.getExp() | h}" ${'class="withborder"' if idx != 0 else ''}>
${childVW.render(Role.VALUE_ONLY)}
</td>
% endfor
Expand Down
38 changes: 38 additions & 0 deletions src/helpers/excep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ricodebug - A GDB frontend which focuses on visually supported
# debugging using data structure graphs and SystemC features.
#
# Copyright (C) 2011 The ricodebug project team at the
# Upper Austrian University Of Applied Sciences Hagenberg,
# Department Embedded Systems Design
#
# This file is part of ricodebug.
#
# ricodebug 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/>.
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.


class GdbError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg


class SourceFileNotFound(Exception):
def __init__(self, filename):
self.filename = filename

def __str__(self):
return self.filename
11 changes: 2 additions & 9 deletions src/helpers/gdbconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@
from gdbreader import GdbReader
from gdboutput import GdbOutput
from PyQt4.QtCore import QObject


class GdbError(Exception):
def __init__(self, msg):
self.msg = msg

def __str__(self):
return self.msg
import helpers


class GdbConnector(QObject):
Expand Down Expand Up @@ -65,7 +58,7 @@ def executeAndRaiseIfFailed(self, cmd, error_msg=None):
logging.error(res.msg)
if error_msg:
logging.error(error_msg)
raise GdbError(res.msg)
raise helpers.excep.GdbError(res.msg)

return res

Expand Down
2 changes: 1 addition & 1 deletion src/models/variablemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def setData(self, index, value, role):
""" QAbstractItemModel flags function
"""
if index.isValid() and role == Qt.EditRole:
index.internalPointer().variable.setValue(value)
index.internalPointer().variable.setValue(value.toString())
self.emit(SIGNAL('dataChanged(QModelIndex, QModelIndex)'), index, index)
return True
return False
Expand Down
2 changes: 1 addition & 1 deletion src/variables/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def getValue(self):

def setValue(self, value):
self.variablepool.assignValue(self.gdbname, value)
self.value = value.toString()
self.value = value

def getInScope(self):
return self.inscope
Expand Down
11 changes: 7 additions & 4 deletions src/views/editorview.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from PyQt4.QtGui import QWidget, QMessageBox
from openedfileview import OpenedFileView
import os
import logging
import helpers.excep


class EditorView(QWidget):
Expand Down Expand Up @@ -124,13 +126,14 @@ def _targetStopped(self, rec):
line = None
for res in rec.results:
if res.dest == "frame":
file_ = res.src.fullname
try:
file_ = res.src.fullname
except AttributeError:
logging.warning("No source for %s found.", res.src.file)
raise helpers.excep.SourceFileNotFound(res.src.file)
line = int(res.src.line) - 1
break

if file_ == None or line == None:
raise "could not interpret stopped message"

# update the ui
for f in self.openedFiles.values():
f.clearExecutionPositionMarkers()
Expand Down

0 comments on commit 00d7a0e

Please sign in to comment.