lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190513201231.GF3198@kernel.org>
Date:   Mon, 13 May 2019 17:12:31 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] perf scripts python: exported-sql-viewer.py: Add
 'About' dialog box

Em Fri, May 03, 2019 at 03:08:28PM +0300, Adrian Hunter escreveu:
> With support for Python 2 or 3 and PySide 1 or 2 (Qt 4 or 5), it is useful
> to see what versions are in use. Add an 'About' dialog box that displays
> Python, PySide, Qt and database server (SQLite or PostgreSQL) version
> numbers.

Works as well, here:

Committer testing:

  $ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db

  Then go to 'Help', then 'About', select all the lines with the mouse
  press 'Control+C', then, on the same terminal press control+shift+V
  which shows my current environment:

Python version:     2.7.16
PySide version:     1
Qt version:         4.8.7
SQLite version:     3.26.0


-------------------

Patchkit applied, thanks.

- Arnaldo
 
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
>  .../scripts/python/exported-sql-viewer.py     | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 
> diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
> index 421f3828ea43..6fe553258ce5 100755
> --- a/tools/perf/scripts/python/exported-sql-viewer.py
> +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> @@ -2927,6 +2927,60 @@ class HelpOnlyWindow(QMainWindow):
>  
>  		self.setCentralWidget(self.text)
>  
> +# PostqreSQL server version
> +
> +def PostqreSQLServerVersion(db):
> +	query = QSqlQuery(db)
> +	QueryExec(query, "SELECT VERSION()")
> +	if query.next():
> +		v_str = query.value(0)
> +		v_list = v_str.strip().split(" ")
> +		if v_list[0] == "PostgreSQL" and v_list[2] == "on":
> +			return v_list[1]
> +		return v_str
> +	return "Unknown"
> +
> +# SQLite version
> +
> +def SQLiteVersion(db):
> +	query = QSqlQuery(db)
> +	QueryExec(query, "SELECT sqlite_version()")
> +	if query.next():
> +		return query.value(0)
> +	return "Unknown"
> +
> +# About dialog
> +
> +class AboutDialog(QDialog):
> +
> +	def __init__(self, glb, parent=None):
> +		super(AboutDialog, self).__init__(parent)
> +
> +		self.setWindowTitle("About Exported SQL Viewer")
> +		self.setMinimumWidth(300)
> +
> +		pyside_version = "1" if pyside_version_1 else "2"
> +
> +		text = "<pre>"
> +		text += "Python version:     " + sys.version.split(" ")[0] + "\n"
> +		text += "PySide version:     " + pyside_version + "\n"
> +		text += "Qt version:         " + qVersion() + "\n"
> +		if glb.dbref.is_sqlite3:
> +			text += "SQLite version:     " + SQLiteVersion(glb.db) + "\n"
> +		else:
> +			text += "PostqreSQL version: " + PostqreSQLServerVersion(glb.db) + "\n"
> +		text += "</pre>"
> +
> +		self.text = QTextBrowser()
> +		self.text.setHtml(text)
> +		self.text.setReadOnly(True)
> +		self.text.setOpenExternalLinks(True)
> +
> +		self.vbox = QVBoxLayout()
> +		self.vbox.addWidget(self.text)
> +
> +		self.setLayout(self.vbox);
> +
>  # Font resize
>  
>  def ResizeFont(widget, diff):
> @@ -3024,6 +3078,7 @@ class MainWindow(QMainWindow):
>  
>  		help_menu = menu.addMenu("&Help")
>  		help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))
> +		help_menu.addAction(CreateAction("&About Exported SQL Viewer", "About this application", self.About, self))
>  
>  	def Try(self, fn):
>  		win = self.mdi_area.activeSubWindow()
> @@ -3109,6 +3164,10 @@ class MainWindow(QMainWindow):
>  	def Help(self):
>  		HelpWindow(self.glb, self)
>  
> +	def About(self):
> +		dialog = AboutDialog(self.glb, self)
> +		dialog.exec_()
> +
>  # XED Disassembler
>  
>  class xed_state_t(Structure):
> -- 
> 2.17.1

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ