slider

Making a Custom Widget in PyQt

In this article, I am going to make a custom widget using PyQt4. Here in this example, we will have have a main form containing a Button and a Widget List. On clicking the button, a progress bar and a label will be added to the Widget List.
So lets Start with the Example, In this example, we will have three files,
File 1. progress.py(containing the progress bar and a label)
File 2. main_ui.py(containing our main form having a Button and a Widget list)
File 3. main.py(We will import progress.py and main_ui.py here and write the main calls here)
This file contains a label and a progress bar, this file will be called in the main.py along with an argument, that argument will be put into label as a string. Just for the sake of demonstration, we are adding incrementing the variable step starting from 0 to 100 and updating it on progress bar. In Case of a download manager, the current file size can be queried and the percentage downloaded can be displayed on the progress bar.
The UI was designed in Qt designer and converted to py using pyuic.

File2: main_ui.py
from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(683, 400)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.listWidget = QtGui.QListWidget(self.centralwidget)
        self.listWidget.setGeometry(QtCore.QRect(50, 150, 591, 192))
        self.listWidget.setObjectName(_fromUtf8("listWidget"))
        self.pushButton = QtGui.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(50, 40, 81, 23))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 683, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.pushButton.setText(_translate("MainWindow", "Add Download", None))
This File has been designed in the Qt designer, Its a form containing a Button and List Widget. The UI file was converted using pyuic.

File3: main.py
import sys
from PyQt4 import QtCore, QtGui
from main_ui import Ui_MainWindow
import progress
import random

reload(progress)
class MyForm(QtGui.QMainWindow):
  def __init__(self, parent=None):
    QtGui.QWidget.__init__(self, parent)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)
    self.ui.pushButton.clicked.connect(self.progress)

  def progress(self):
 item = QtGui.QListWidgetItem(self.ui.listWidget)
 item_widget = progress.Ui_("It works")
 item.setSizeHint(item_widget.sizeHint())
 self.ui.listWidget.addItem(item)
 self.ui.listWidget.setItemWidget(item,item_widget)

if __name__ == "__main__":
  app = QtGui.QApplication(sys.argv)
  myapp = MyForm()
  myapp.show()
  sys.exit(app.exec_())

In this file, we connect the onclick event of the Button to the progress function. The function progress creates a new instance of custom widget from progress.py  and adds the custom widget to the QListWidget.

Read More(Full Post)...

Extract Image Perfectly from Background using Photoshop Extract Tool

Extract Tool is a filter tool in Photoshop which is used to extract out an image from its background. But unfortunately it has been removed from Photoshop CS5 and CS4. It is present under filter menu in photoshop’s  previous versions. As the name suggests, this tool makes it very easier to extract an image out of its background. Especially the ‘furry’ part of the image. Its also a preferred tool to extract the image of a person as it can extract the hairs perfectly.
This tool can be manually installed in Photoshop CS5 and Photoshop CS4  by downloading the file from below given link and putting it into specified folder.

Read More(Full Post)...

How to Remove Genuine Notification on Windows XP

Here is a trick on how to remove Genuine Notification from Microsoft. I have only tried this on XP. Just follow this procedures:

1. Lauch Windows Task Manager.
2. End wgatray.exe process in Task Manager.
3. Restart Windows XP in Safe Mode.
4. Delete WgaTray.exe from c:\Windows\System32.
5. Delete WgaTray.exe from c:\Windows\System32\dllcache.
6. Search computer for 'wga*.*' and delete everything like wganotify and wgatray
7. Lauch RegEdit.
8. Browse to the following location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
    Windows NT\CurrentVersion\Winlogon\Notify
9. Delete the folder ‘WgaLogon’ and all its contents
10. Reboot Windows XP.

Done!!!

Blogumus: 3D Spherical Flash Animated Cloud Tag for Blogger

"Blogumus" is an Flash based tag cloud widget which uses scripts converted from Roy Tanck's WP Cumulus plugin for Wordpress. Hover your mouse over the Flash object on the right side to see the animation begin. In this post, I'll explain how you can add Blogumus to your own Blogger layout with ease!
How to install Blogumus in your Blogger layout?
Installing Blogumus in your Blogger layout is surprisingly simple! You should only need to copy and paste a section of code to your Blogger template, though any tweaks for the style of display will require some manual editing. Here are the steps required to install Blogumus in your Blogger layout:

Read More(Full Post)...

Fix External/Flash Drive Folders Changed to Shortcuts Virus


Some Viruses changes our files on our Flash Drive or External Hard Drive changed into Shortcuts. We can’t open the files from our Pen/Thumb drives. Many people are getting this Virus from their Work Place and Losing their Data. How do i get my files back so that I can view them? Most viruses delete the “Folder options” menu and “Task Manager” as well.
Solution to Fix External/Flash Drive Files Changed into Shortcuts :

Read More(Full Post)...

Get Accidentally Deleted Posts Back

If you delete your blog by mistake, there are 100% chances of recovering it by using the blogger's Undelete this blog feature but unfortunately these is no option like Undelete this post. So how do we get the accidentally deleted posts back?
There are three ways, one of which depends on the cooperation of a helper plus a good memory or clever guesswork.

Read More(Full Post)...

Google Wallet is out now

NEW YORK: Google's Wallet is getting thicker, with the addition of Visa, American Express and Discover to the search company's payment system, which aims to make cellphones the credit cards of tomorrow.

MasterCard, the other major payment processor, is already part of the project. And Google released the Wallet application on Monday for one Sprint smartphone for users with MasterCards.

People with that phone will be able to "load" a Citibank MasterCard into the Wallet application on the phone, and pay by tapping the phone to wireless-capable payment terminals in stores instead of swiping a credit card. Visa, American Express and Discover cards are set to appear later. Visa plans to bring out its own, competing wallet application as well. 


Read More(Full Post)...

Make an Invisible Folder in Windows

You can create an Invisible folder in Windows by naming it with a blank space and changing its icon to transparent.
 Follow these Steps:
  • Right click on desktop>New>Folder
  • Rename it as “ALT + 0160” (means enter the sequence '0160' with ALT key pressed)
  • You will notice that a blank space is used for naming the folder.
  • Now right click on folder>properties>Customize>change icon…
  • Choose a blank icon and click on OK.
  • Your invisible folder is ready to work. 
Customize it further to protect it further by changing it to hidden folder.
  • Right click on folder>properties>hidden
  • click on OK.

Backup Data on Google using Google Takeout

Isn't it a good idea, having the backup of your data which you stored on Google with yourself as-well? Google’s Data Liberation Front team has launched a new data storage service called Google Takeout, which helps the users to create backups of data from all Google services like Buzz, Picasa along with Google contacts and Google+ circles. So this was the greatest way to backup all of your Google Data Easily.
The Google Takeout service allows you take backups of all your Google data and export it as zip or other open file formats. Users can choose a single backup for data from all supported Google services or one backup per service.

Its as simple as Google. Just go to GOOGLE TAKEOUT PAGE and select the service that you want to take backup or you can take the backup of whole Google Data there.
Check out the video below to learn more.



Windows 8 Developer Preview ISO (64 & 32 Bit download)

Microsoft released a Windows 8 Developer Preview publicly, so that means you don’t need a developer’s license to get at it. Anyone can download the Windows 8 Developer Preview ISO 64 & 32 Bit and see what Windows 8 has. To try new Windows 8 on you PC you need need a PC with a 1GHz or faster processor (either 32- or 64-bit), 1GB of RAM (2GB for 64-bit), 16GB of hard disk space (20GB for 64-bit), DirectX 9 graphics with WDDM 1.0 or higher driver.
 
 DOWNLOAD HERE
1. Windows Developer Preview with developer tools English, 64-bit (x64)
2. Windows Developer Preview English, 64-bit (x64)
3. Windows Developer Preview English, 32-bit (x86)

The new Windows 8 OS comes with a new Metro UI, App Store and more new features. With the new release of Windows 8 there are new Windows 8 Keyboard Shotcuts are available. Below are the 18 official shortcut keys to access some of the features in Windows 8 operating system.

 Windows 8 Keyboard Shortcuts -
Windows Logo Key + Spacebar – Switch input language and keyboard layout
Windows Logo Key + Y – Temporarily peek at the desktop
Windows Logo Key + O – Locks device orientation
Windows Logo Key + V – Cycles through toasts
Windows Logo Key + Shift + V – Cycles through toasts in reverse order
Windows Logo Key + Enter – Launches Narrator
Windows Logo Key + PgUp – Moves tiles to the left
Windows Logo Key + PgDown – Moves tiles to the right
Windows Logo Key + Shift + . – Moves the split to the left
Windows Logo Key + . – Moves the split to the right
Windows Logo Key + F – Opens File Search App
Windows Logo Key + C – Opens Charms Bar
Windows Logo Key + I – Opens Settings charm
Windows Logo Key + K – Opens Connect charm
Windows Logo Key + H – Opens Share charm
Windows Logo Key + Q – Opens Search pane
Windows Logo Key + W – Opens Settings Search app
Windows Logo Key + Z – Opens App Bar

You can also access the Windows 8 Developer Preview guide. This downloadable guide shows you new features for developers, consumers and businesses.
Download PDF       Download XPS

Related Posts Plugin for WordPress, Blogger...
 
Download & Learning © 2011 | Contact