Exemple #1
0
 def setUp(self):
   tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/import')
   self.prop_name = 'test_prop'
   self.prop = None
   self.graph = tlp.importGraph('Grid')
   self.n = self.graph.getRandomNode()
   self.e = self.graph.getRandomEdge()
   sg_nodes = [tlp.node(i) for i in range(self.graph.numberOfNodes()//2)]
   self.sub_graph = self.graph.inducedSubGraph(sg_nodes)
Exemple #2
0
sys.path.pop()
if platform.system() == 'Windows' and sys.version_info >= (3, 8):
    for d in dirs:
        d.close()


class tlpgui(_tulipgui.tlpgui):
    pass


def tulipguiExitFunc():
    import tulipgui
    tulipgui.tlpgui.runQtMainLoop()


tlp.loadTulipPluginsFromDir(_tulipGuiPluginsPath)

# Check if we are in script execution mode
# (sys.ps1 is not defined in that case)
# If so, register an exit callback that will run the Qt event loop
# if some widgets are still in a visible state
if not hasattr(sys, 'ps1') and not sys.flags.interactive:
    import atexit
    atexit.register(tulipguiExitFunc)

import signal  # noqa
signal.signal(signal.SIGINT, signal.SIG_DFL)

__all__ = ['tlpgui']
__author__ = 'David Auber, and the Tulip development Team'
__license__ = 'LGPLv3'
Exemple #3
0
def tulipguiExitFunc():
  import tulipgui
  tulipgui.tlpgui.runQtMainLoop()

# fix loading of Tulip plugins when the tulipgui module has been installed through pip
if platform.system() == 'Linux' and os.path.exists(_tulipGuiNativePluginsPath):
  dlOpenFlagsBackup = sys.getdlopenflags()
  if sys.version_info < (3, 6):
    import DLFCN
    dlOpenFlags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL
  else:
    dlOpenFlags = os.RTLD_NOW | os.RTLD_GLOBAL
  sys.setdlopenflags(dlOpenFlags)

tlp.loadTulipPluginsFromDir(_tulipGuiPluginsPath)

if platform.system() == 'Linux' and os.path.exists(_tulipGuiNativePluginsPath):
  sys.setdlopenflags(dlOpenFlagsBackup)

# Check if we are in script execution mode (sys.ps1 is not defined in that case)
# If so, register an exit callback that will run the Qt event loop if some widgets are
# still in a visible state
if not hasattr(sys, 'ps1') and not sys.flags.interactive:
  import atexit
  atexit.register(tulipguiExitFunc)

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

__all__ = ['tlpgui']
Exemple #4
0
def safeprint(s, file=None):
  try:
    print(s, file=file)
  except UnicodeEncodeError:
    if sys.version_info >= (3,):
      print(s.encode('utf8').decode(sys.stdout.encoding), file=file)
    else:
      print(s.encode('utf8'), file=file)

def utf8len(s):
  if sys.version_info >= (3,):
    return len(s.encode('utf8').decode(sys.stdout.encoding))
  else:
    return len(s.encode('utf8'))

tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/clustering')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/colors')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/export')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/general')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/import')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/layout')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/metric')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/selection')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/sizes')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/string')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/test')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_PYTHON_PLUGINS_DIR'])
tlp.loadTulipPluginsFromDir(os.environ['TULIPGUI_PYTHON_PLUGINS_DIR'])

f = open('tulippluginsdocumentation.rst','w')
Exemple #5
0
        print(s, file=file)
    except UnicodeEncodeError:
        if sys.version_info >= (3, ):
            print(s.encode('utf8').decode(sys.stdout.encoding), file=file)
        else:
            print(s.encode('utf8'), file=file)


def utf8len(s):
    if sys.version_info >= (3, ):
        return len(s.encode('utf8').decode(sys.stdout.encoding))
    else:
        return len(s.encode('utf8'))


tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] +
                            '/plugins/clustering')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/colors')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/export')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/general')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/import')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/layout')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/metric')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] +
                            '/plugins/selection')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/sizes')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/string')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_BUILD_DIR'] + '/plugins/test')
tlp.loadTulipPluginsFromDir(os.environ['TULIP_PYTHON_PLUGINS_DIR'])
tlp.loadTulipPluginsFromDir(os.environ['TULIPGUI_PYTHON_PLUGINS_DIR'])

f = open('tulippluginsdocumentation.rst', 'w')
Exemple #6
0
def safeprint(s, file=None):
    try:
        print(s, file=file)
    except UnicodeEncodeError:
        print(s.encode('utf8'), file=file)


def utf8len(s):
    if sys.version_info >= (3, ):
        return len(s)
    else:
        return len(s.encode('utf8'))


tulip_build_dir = os.environ['TULIP_BUILD_DIR']
tlp.loadTulipPluginsFromDir('%s/plugins/clustering' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/colors' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/export' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/general' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/import' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/layout' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/metric' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/selection' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/sizes' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/string' % tulip_build_dir)
tlp.loadTulipPluginsFromDir('%s/plugins/test' % tulip_build_dir)
tlp.loadTulipPluginsFromDir(os.environ['TULIP_PYTHON_PLUGINS_DIR'])
tlp.loadTulipPluginsFromDir(os.environ['TULIPGUI_PYTHON_PLUGINS_DIR'])

if sys.version_info >= (3, ):
    f = open('tulippluginsdocumentation.rst', 'w', encoding='utf-8')