-# Copyright (C) 2009-2012 OPEN CASCADE
+# Copyright (C) 2009-2015 OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
import traceback
from SalomePyQt import *
import PYLIGHT_DataModel
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
+from qtsalome import *
import libSALOME_Swig
import os
sgPyQt.createAction(dict_actions["editLine"], "Edit Line", "Edit selected line")
# Remove selected line action
sgPyQt.createAction(dict_actions["removeLine"], "Remove Lines", "Remove selected lines")
+ # Clear paragraph
+ sgPyQt.createAction(dict_actions["clearParagraph"], "Clear Paragraph", "Clear selected paragraph")
# Clear all paragraphs
sgPyQt.createAction(dict_actions["clearAll"], "Clear All", "Clear all paragraphs")
# Display line
ctx = _setContext( _getStudyId() )
postfix = "PYLIGHT.txt"
filename = prefix+postfix
- ctx.DM.saveFile(QString(filename))
+ ctx.DM.saveFile(filename)
return postfix
# For restore data from the study
ctx = _setContext( _getStudyId() )
aFilter = "Text files (*.txt)"
filename = QFileDialog.getOpenFileName(sgPyQt.getDesktop(), "Open text file", "", aFilter, "Choose a text file to open")
- if filename.isEmpty():
+
+ print filename
+ if isinstance(filename,tuple) and len(filename) >=2:
+ filename = filename[0]
+
+ filename = unicode(filename)
+
+ if len(filename) == 0:
return
if os.access(str(filename),os.R_OK):
else:
QMessageBox.warning(sgPyQt.getDesktop(),
"Error!",
- QString("Can not read file:\n%1").arg(filename))
+ "Can not read file:\n%s"%(filename))
pass
sg.updateObjBrowser(True)
pass
ctx = _setContext( _getStudyId() )
aFilter = "Text files (*.txt)"
filename = QFileDialog.getSaveFileName(sgPyQt.getDesktop(),"Save text file", "", aFilter, "Choose a text file to save")
- if filename.contains(".txt") == 0:
- filename.append(".txt")
+
+ print filename
+ if isinstance(filename,tuple) and len(filename) >=2:
+ filename = filename[0]
+
+ filename = unicode(filename)
+
+ if filename.endswith(".txt") == 0:
+ filename+=".txt"
pass
+
fn = filename
# Get directory name and check access
- if os.access(str(fn.left(fn.lastIndexOf("/"))), os.W_OK):
+ if os.access(str(fn[:fn.rindex(os.path.sep)]), os.W_OK):
ctx.DM.saveFile(filename)
else:
QMessageBox.warning(sgPyQt.getDesktop(),
"Error!",
- QString("Can not save file:\n%1").arg(filename))
+ "Can not save file:\n%s"%(filename))
pass
pass
return
text = res[0]
+ print "RNV: !", res
# Nb selected objects
selcount = sg.SelectedCount()
# Nb object in the Data Model
# Return vtkActor by entry
def getActor(entry):
- if isinstance(entry,QString):
- entry = entry.toLatin1().data()
+ entry = str(entry)
if dict_actors.has_key(entry):
return dict_actors[entry]
return None