示例#1
0
    def addContents(self):
        notebook = Gtk.Notebook()
        notebook.set_scrollable(True)
        notebook.popup_enable()
        docDir = plugins.installationDir("doc")
        versionInfo = self.readVersionInfo(docDir)
        for version in reversed(sorted(versionInfo.keys())):
            buffer = Gtk.TextBuffer()
            buffer.set_text(versionInfo[version])
            textView = Gtk.TextView.new_with_buffer(buffer)
            textView.set_editable(False)
            textView.set_cursor_visible(False)
            textView.set_left_margin(5)
            textView.set_right_margin(5)
            scrolledWindow = Gtk.ScrolledWindow()
            scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            scrolledWindow.add(textView)
            scrolledWindow.set_shadow_type(Gtk.ShadowType.IN)
            versionStr = ".".join(map(str, version))
            notebook.append_page(scrolledWindow, Gtk.Label(label=self.labelPrefix() + versionStr))

        if notebook.get_n_pages() == 0:  # pragma : no cover - should never happen
            raise plugins.TextTestError("\nNo " + self.getTitle() + " could be found in\n" + docDir + "\n")
        else:
            parentSize = self.topWindow.get_size()
            self.dialog.resize(int(parentSize[0] * 0.9), int(parentSize[1] * 0.7))
            self.dialog.vbox.pack_start(notebook, True, True, 0)
示例#2
0
 def createView(self):
     hbox = gtk.HBox()
     self.label = gtk.Label()
     self.label.set_name("GUI status")
     self.label.set_ellipsize(pango.ELLIPSIZE_END)
     # It seems difficult to say 'ellipsize when you'd otherwise need
     # to enlarge the window', so we'll have to settle for a fixed number
     # of max char's ... The current setting (90) is just a good choice
     # based on my preferred window size, on the test case I used to
     # develop this code. (since different chars have different widths,
     # the optimal number depends on the string to display) \ Mattias++
     self.label.set_max_width_chars(90)
     self.label.set_use_markup(True)
     self.label.set_markup(self.initialMessage)
     hbox.pack_start(self.label, expand=False, fill=False)
     imageDir = plugins.installationDir("images")
     try:
         staticIcon = os.path.join(imageDir, "throbber_inactive.png")
         temp = gtk.gdk.pixbuf_new_from_file(staticIcon)
         self.throbber = gtk.Image()
         self.throbber.set_from_pixbuf(temp)
         animationIcon = os.path.join(imageDir, "throbber_active.gif")
         self.animation = gtk.gdk.PixbufAnimation(animationIcon)
         hbox.pack_end(self.throbber, expand=False, fill=False)
     except Exception, e:
         plugins.printWarning("Failed to create icons for the status throbber:\n" + str(e) + \
                              "\nAs a result, the throbber will be disabled.", stdout=True)
         self.throbber = None
示例#3
0
 def createView(self):
     hbox = Gtk.HBox()
     self.label = Gtk.Label()
     self.label.set_name("GUI status")
     self.label.set_ellipsize(Pango.EllipsizeMode.END)
     # It seems difficult to say 'ellipsize when you'd otherwise need
     # to enlarge the window', so we'll have to settle for a fixed number
     # of max char's ... The current setting (90) is just a good choice
     # based on my preferred window size, on the test case I used to
     # develop this code. (since different chars have different widths,
     # the optimal number depends on the string to display) \ Mattias++
     self.label.set_max_width_chars(90)
     self.label.set_use_markup(True)
     self.label.set_markup(self.initialMessage)
     hbox.pack_start(self.label, False, False, 0)
     imageDir = plugins.installationDir("images")
     try:
         staticIcon = os.path.join(imageDir, "throbber_inactive.png")
         temp = GdkPixbuf.Pixbuf.new_from_file(staticIcon)
         self.throbber = Gtk.Image.new_from_pixbuf(temp)
         animationIcon = os.path.join(imageDir, "throbber_active.gif")
         self.animation = GdkPixbuf.PixbufAnimation.new_from_file(
             animationIcon)
         hbox.pack_end(self.throbber, False, False, 0)
     except Exception as e:
         plugins.printWarning(
             "Failed to create icons for the status throbber:\n" + str(e) +
             "\nAs a result, the throbber will be disabled.",
             stdout=True)
         self.throbber = None
     self.widget = Gtk.Frame()
     self.widget.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
     self.widget.add(hbox)
     self.widget.show_all()
     return self.widget
示例#4
0
    def getRemoteCmd(self, machine, app, pythonScript, extraArgs):
        binDir = plugins.installationDir("libexec")
        localPath = os.path.join(binDir, pythonScript)
        appTmpDir = app.getRemoteTmpDirectory()[1]
        if appTmpDir:
            logDir = os.path.join(appTmpDir, "Xvfb")
            app.ensureRemoteDirExists(machine, logDir)
            remotePath = os.path.join(appTmpDir, pythonScript)
            app.copyFileRemotely(localPath, "localhost", remotePath, machine)
            fullPath = remotePath
            pythonArgs = ["python", "-u"]
        else:
            logDir = self.getPersonalLogDir()
            fullPath = localPath
            pythonArgs = self.findPythonArgs(machine)

        cmdArgs = pythonArgs + [fullPath, logDir] + extraArgs
        return app.getCommandArgsOn(machine, cmdArgs)
示例#5
0
 def __init__(self, recordSetting):
     self.recordSetting = recordSetting
     libexecDir = plugins.installationDir("libexec")
     self.siteCustomizeFile = os.path.join(libexecDir, "sitecustomize.py")
示例#6
0
def getImageDir():
    retro = guiConfig.getValue("retro_icons")
    currImageDir = plugins.installationDir("images")
    retroDir = os.path.join(currImageDir, "retro")
    return (retroDir, True) if retro != 0 else (currImageDir, False)