Páginas

domingo, 24 de mayo de 2020

Bound ComboBox Pyqt5

I've been looking for long time code for a combobox with signals and I find this in stackoverflow Como-crear-un-combobox-en-python-con-pyqt5-en-el-cual-sus-valores-dependan-de-l but I need something for MySQL, so I change some things in the code.



You can find the code for MariaDB/MySQL in Github.


viernes, 22 de noviembre de 2019

Python, Qt and MariaDB

Hi everyone, I'd like to share the next code for beginners in Python, Qt and MariaDB with a little explanation, the code is available in GitHub https://github.com/gerasua/openwindows. When you try to create one app for Windows desktop you think in Java, .Net but this time I want to show you how to create a Desktop App with Python and Qt for Windows, this App have a login authentication and help to you to understand how works Python and Qt, for this we need to use PyQt5. We build windows with Qt Designer 


You need create your database, here I show you how to install XAMPP

When you have your windows designs you need code in Python, but first install dependencies, pyqt5 and mysql-connector, open a terminal and install
$ pip install pyqt5
$pip install mysql-connector

Open you editor, I like Pycharm Community Edition


but how works?
You Login with the next users and passwords
Level 1
user: operator
password: operator


You're available to send value to another window


You can read the value from the previous window


Finally you logout closing the window or press the scape key





Level 2
user: supervisor
password: supervisor






Level 3
user: admin
password: admin




viernes, 6 de septiembre de 2019

How to install XAMPP

The first we need is install net-tools
$ sudo apt install net-tools
Download XAMPP
https://www.apachefriends.org/es/download.html
$ sudo chmod +x xampp-linux-x64-7.3.9-0-installer.run
$ sudo ./xampp-linux-x64-7.3.9-0-installer.run



Change the MySQL/MariaDB root password, follow these steps:
$ cd /opt/lampp/
$ /opt/lampp/bin/mysqladmin --user=root password "ChooseOne"
$ /opt/lampp/bin/mysql -u root -p -e "FLUSH PRIVILEGES;"

For log in phpmyadmin edit config.inc.php
$ cd /opt/lampp/phpmyadmin
$ sudo vim config.inc.php
Search this lines
$cfg['blowfish_secret'] = 'xampp';
change for
$cfg['blowfish_secret'] = 'ForSomeThingElse';

Now we need the password 
$cfg['Servers'][$i]['password'] = '';
and change that with your password
$cfg['Servers'][$i]['password'] = 'ChooseOne';

Now, for enviroments in production we need to change this line
$cfg['Servers'][$i]['auth_type'] = 'config';
To
$cfg['Servers'][$i]['auth_type'] = 'cookie';

Change this too
$cfg['Servers'][$i]['AllowNoPassword'] = true;
To
$cfg['Servers'][$i]['AllowNoPassword'] = false;

open a browser, go to http://localhost/phpmyadmin and log in.

Stop, start the service:
$ cd /opt

$ sudo ./xampp start
[sudo] password for user:          
Starting XAMPP for Linux 7.3.9-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.

XAMPP: Starting ProFTPD...ok.